Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOException, lock on dll by other process #43

Open
nojaf opened this issue Jul 15, 2019 · 2 comments
Open

IOException, lock on dll by other process #43

nojaf opened this issue Jul 15, 2019 · 2 comments

Comments

@nojaf
Copy link

nojaf commented Jul 15, 2019

Hi, I don't really know how I to describe this but sometimes on reload, I have an IOException like this:

System.IO.IOException: The process cannot access the file 'C:\Users\nojaf\Projects\ronnies.be\src\server\bin\Debug\netcoreapp2.2\Ronnies.Server.dll' because it is being used by another process.
   at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at FcsWatch.Binary.Extensions.Logger.CopyFile(Logger x, String src, String dest) in D:\Users\Jia\Downloads\FCSWatch-watch-content\FCSWatch-watch-content\src\FcsWatch.Binary\Extensions.fs:line 47
   at FcsWatch.Binary.Extensions.SingleTargetCrackedFsproj.copyObjToBin[a](a configuration, SingleTargetCrackedFsproj singleTargetCrackedFsproj) in D:\Users\Jia\Downloads\FCSWatch-watch-content\FCSWatch-watch-content\src\FcsWatch.Binary\Extensions.fs:line 82
   at FcsWatch.Binary.Extensions.CrackedFsproj.copyObjToBin@115-1.Invoke(SingleTargetCrackedFsproj singleTargetCrackedFsproj) in D:\Users\Jia\Downloads\FCSWatch-watch-content\FCSWatch-watch-content\src\FcsWatch.Binary\Extensions.fs:line 115
   at Microsoft.FSharp.Primitives.Basics.List.iter[T](FSharpFunc`2 f, FSharpList`1 x)
   at Microsoft.FSharp.Collections.ListModule.Iterate[T](FSharpFunc`2 action, FSharpList`1 list)
   at FcsWatch.Binary.Extensions.CrackedFsproj.copyObjToBin[a](a configuration, CrackedFsproj crackedFsproj) in D:\Users\Jia\Downloads\FCSWatch-watch-content\FCSWatch-watch-content\src\FcsWatch.Binary\Extensions.fs:line 115
   at FcsWatch.Binary.AutoReload.TmpEmitterStateModule.tryEmit@216-1.Invoke(String projPath) in D:\Users\Jia\Downloads\FCSWatch-watch-content\FCSWatch-watch-content\src\FcsWatch.Binary\AutoReload.fs:line 219
   at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc`2 action, IEnumerable`1 source)
   at FcsWatch.Binary.AutoReload.TmpEmitterStateModule.tryEmit(ProgramRunningArgs args, CompilerTmpEmitterState`2 state) in D:\Users\Jia\Downloads\FCSWatch-watch-content\FCSWatch-watch-content\src\FcsWatch.Binary\AutoReload.fs:line 212
   at FcsWatch.Binary.AutoReload.create@240.FcsWatch-Core-CompilerTmpEmitter-ICompilerTmpEmitter`3-TryEmit(String _arg1, CompilerTmpEmitterState`2 state) in D:\Users\Jia\Downloads\FCSWatch-watch-content\FCSWatch-watch-content\src\FcsWatch.Binary\AutoReload.fs:line 241
   at FcsWatch.Core.CompilerTmpEmitter.loop@151-14.Invoke(CompilerTmpEmitterMsg`2 _arg1) in D:\Users\Jia\Downloads\FCSWatch-watch-content\FCSWatch-watch-content\src\FcsWatch.Core\CompilerTmpEmitter.fs:line 176
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1)
   at <StartupCode$FSharp-Core>.$Mailbox.processFirstArrival@344-8.Invoke(AsyncActivation`1 ctxt)
   at FcsWatch.Core.CompilerTmpEmitter.loop@150-15.Invoke(AsyncActivation`1 ctxt) in D:\Users\Jia\Downloads\FCSWatch-watch-content\FCSWatch-watch-content\src\FcsWatch.Core\CompilerTmpEmitter.fs:line 150
   at <StartupCode$FSharp-Core>.$Mailbox.processFirstArrival@344-8.Invoke(AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)

I'm using JetBrains Rider so that might have something to do with it.
Other than that I think my project is a fairly standard aspnet core application.
Is there anything I can do about this?

@humhei
Copy link
Owner

humhei commented Jul 17, 2019

https://github.com/humhei/FCSWatch/blob/master/src/FcsWatch.Binary/AutoReload.fs#L219
https://github.com/humhei/FCSWatch/blob/master/src/FcsWatch.Binary/AutoReload.fs#L210

CrackedFsproj.tryKill args.DevelopmentTarget cache.EntryCrackedFsproj

Before copy dll from obj to bin,
FcsWatch will try to kill the current project first.
The asp.net core application should be killed

logger.InfoGreen "Killed process %d" proc.Id

@nojaf Can you try to set logger level to normal and see whether this line is printed?

@nojaf
Copy link
Author

nojaf commented Jul 21, 2019

Yes, this line is being printed

detect file C:\Users\nojaf\Projects\ronnies.be\src\server\Schema.fs changed
compilerTmpEmitter agent receive message IncrCompilingNum,current compiling number is 1
compilerTmpEmitter agent receive message AddTask,current compiling number is 1
Summary:
        -- origin: C:\Users\nojaf\Projects\ronnies.be\src\server\Ronnies.Server.fsproj
        -- dest: C:\Users\nojaf\Projects\ronnies.be\src\server\obj\Debug\netcoreapp2.2\Ronnies.Server.dll
        -- elapsed: 1784 milliseconds
compilerTmpEmitter agent receive message AddTmp,current compiling number is 1
compilerTmpEmitter agent receive message DecrCompilingNum,current compiling number is 0
Current cached compier task is 2
Killed process 15992
System.IO.IOException: The process cannot access the file 'C:\Users\nojaf\Projects\ronnies.be\src\server\bin\Debug\netcoreapp2.2\Ronnies.Server.dll' because it is being used by another process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants