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

Omnisharp locking analyzer DLLs #1465

Closed
rchande opened this issue Apr 17, 2019 · 5 comments · Fixed by #1474
Closed

Omnisharp locking analyzer DLLs #1465

rchande opened this issue Apr 17, 2019 · 5 comments · Fixed by #1474

Comments

@rchande
Copy link

rchande commented Apr 17, 2019

I can't share the project, but when I dotnet build a .net core/xunit project that I've opened in VS Code, I sometimes get:

C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\NuGet.targets(119,5): error : Access to the path 'xunit.analyzers.dll' is denied. [C:\MLS-Monitoring\Monitoring.sln]

Killing omnisharp seems to make the build succeed.
cc @savpek

@filipw
Copy link
Member

filipw commented Apr 17, 2019

That would be correct, our implementation of Roslyn's IAnalyzerAssemblyLoader is our own AssemblyLoader used for other things, and it doesn't shadow copy or read bytes unless explicitly asked to. Roslyn does this https://github.com/dotnet/roslyn/blob/master/src/Compilers/Shared/ShadowCopyAnalyzerAssemblyLoader.cs

@bjorkstromm
Copy link
Member

We have the dontLockAssemblyOnDisk option here. https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Host/Services/AssemblyLoader.cs#L69 We use that when loading Cake.Core for HostObject

var hostObjectType = Type.GetType(cakeScript.Host.TypeName, a => _assemblyLoader.LoadFrom(cakeScript.Host.AssemblyPath, dontLockAssemblyOnDisk: true), null, false);

@savpek
Copy link
Contributor

savpek commented Apr 18, 2019

Tested omnisharp assembly loader with file bit true. However it causes errors:
Could not load file or assembly 'Microsoft.CodeAnalysis.Analyzers, Version=2.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.":"Microsoft.CodeAnalysis.Analyzers, Version=2.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"} | System.Exception {System.IO.FileNotFoundException}

Does Assembly.Load(byte[] ...) support binding redirects? There may be difference between Assembly.LoadFrom and Assembly.Load that is hit here.

I think i will write analyzer assembly loader based on roslyn shadow copy loader. Another solution is to invoke existing via reflection, dunno how robust solution that is 🙂

@filipw
Copy link
Member

filipw commented Apr 18, 2019

the shadow copy seems like a safe way to go indeed

@savpek
Copy link
Contributor

savpek commented Apr 21, 2019

@rchande can you try version from #1474 if issue will be fixed by it.

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

Successfully merging a pull request may close this issue.

4 participants