Error when saving in code editor

Sometimes when saving a Dynamic Plugin:

Basically I can’t load current assembly, so it throws an exception and doesn’t recompile the plugin.

Exception is thrown in CSProjectFactory -> IsAssemblyUpToDate(CSProject project)

Stack trace

A first chance exception of type ‘System.IO.FileLoadException’ occurred in mscorlib.dll
Error: System.IO.FileLoadException in mscorlib: Could not load file or assembly ‘file:///E:\plugins\StringParseComments\bin\Dynamic-785338757.dynamic.13.dll’ or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)

Stacktrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile)
at VVVV.Hosting.Factories.CSProjectFactory.IsAssemblyUpToDate(CSProject project) in e:\repositories\vvvv\vvvv-sdk\vvvv45\src\core\Hosting\Factories\CSProjectFactory.cs:line 189
at VVVV.Hosting.Factories.CSProjectFactory.RecompileIfNeeded(CSProject project) in e:\repositories\vvvv\vvvv-sdk\vvvv45\src\core\Hosting\Factories\CSProjectFactory.cs:line 124
at VVVV.Hosting.Factories.CSProjectFactory.LoadNodeInfos(String filename) in e:\repositories\vvvv\vvvv-sdk\vvvv45\src\core\Hosting\Factories\CSProjectFactory.cs:line 67
at VVVV.Hosting.Factories.AbstractFileFactory1.ExtractNodeInfos(String filename, String arguments) in e:\repositories\vvvv\vvvv-sdk\vvvv45\src\core\Hosting\Factories\AbstractFileFactory.cs:line 98 at VVVV.Hosting.Factories.AbstractFileFactory1.FileChanged(String filename) in e:\repositories\vvvv\vvvv-sdk\vvvv45\src\core\Hosting\Factories\AbstractFileFactory.cs:line 356
at VVVV.Hosting.Factories.CSProjectFactory.project_ProjectCompiled(Object sender, CompilerEventArgs args) in e:\repositories\vvvv\vvvv-sdk\vvvv45\src\core\Hosting\Factories\CSProjectFactory.cs:line 164
at VVVV.Core.Model.CompiledEventHandler.Invoke(Object sender, CompilerEventArgs args)
at VVVV.Core.Model.Project.OnProjectCompiledSuccessfully(CompilerEventArgs args) in e:\repositories\vvvv\vvvv-sdk\common\src\core\Core\Model\Project.cs:line 225

thx. because i can’t reproduce i’ve basically added a try-catch to the method so it should less likely crash. hope that helps.