Hi, I am getting the following error message when debugging a project that references my own library:
System.IO.FileNotFoundException
“Could not load file or assembly ‘System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ or one of its dependencies. The system cannot find the file specified.”
Just to confirm, is it a regular .NET project that you debug from Visual Studio or one that is compiled with Scripter and debugged with our Script Debugger?
In the first case, most likely, you have some packages that reference different versions of the System.Memory assembly. Usually, these conflicts are resolved by providing binding redirects. A bit more information can be found here:
We’re happy to have a closer look if you send us your .csproj file so we can examine what external reference causes the conflict.
I cannot send you the project as it is part of the system and it is referencing our own DLLs.
Once the project is referencing our own DLLs, it will take hours for the debugger to load. I find that I have to switch ScriptRun.ScriptHost.ResolveRecursiveReferences to false to get the debugger to load in normal time.
Also, ScriptRun.ScriptSource.SearchPaths doesn’t seems to work when the document said that it is used for searching for references.
I set the ScriptRun.ScriptSource.SearchPaths to the path with all the DLLs before Debugger.StartDebugging(StartDebuggingOptions) but it does not work.
We will look at generating config files for .NET framework.
Meanwhile, could you please make sure System.Memory.dll presents at all in the folder where the scripter generates an executable? Maybe it is the issue with copying this assembly rather than conflicts between different versions?
ResolveRecursiveReferences does load all assemblies to find out dependent assemblies to copy all of them to the same folder where script assembly is generated, which may be fairly slow - we will see how we can optimize it.
SearchPaths is only intended to find reference assemblies while compiling, but when executing, these assemblies need to be next to the scripter executable.
I look forward to the .NET Framework config files generation.
There are missing DLLs in the output folder of the compile because of the ResolveRecursiveReferences being turned off. But there are also mismatched DLLs - I’ve confirmed that my introducing the config file with DLL references remapped specified.
I also looked forward to the optimised ResilveRecursiveReferences properties.
Thank you for confirming. We will try to include these two items (config file generation for .NET Framework and optimization related to gathering all references) in the next major update.