question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GetFileDependsOnNETStandard holds handles to assemblies after it returns

See original GitHub issue

I believe this is the root cause of https://github.com/NuGet/Home/issues/5609.

I’ve been looking at this with @mishra14.

It appears that GetFileDependsOnNETStandard, introduced to support .NET Standard 2.0 in VS 15.3, holds locks on files longer than it should.

It appears to close the handle to the files it’s inspecting, but we can observe through the debugger that they don’t get closed immediately–stepping over that line and running a handle.exe search shows the handle still open.

When devenv.exe is started from an environment with set ImplicitlyExpandNETStandardFacades=false, project creation succeeds. That property disables calling GetDependsOnNETStandard.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ericstjcommented, Jul 25, 2017

I see. I suspect we’re missing this: https://github.com/Microsoft/msbuild/blob/cc5661488dba7c2a25ad1555fee08a9237a2414b/src/Tasks/AssemblyDependency/AssemblyInformation.cs#L500-L503

So in the finally block add:

if (assemblyImport != null)
{
    Marshal.ReleaseComObject(assemblyImport);
}
if (metadataDispenser != null)
{
    Marshal.ReleaseComObject(metadataDispenser);
}
0reactions
livarcocccommented, Jan 27, 2018

I see that @ericstj has fixed this issue already. As such I am going to close it. If that’s not the case, just comment and we can re-activate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS 15.3 came with new unexpected and not actionable ...
Instrumentation have shown that GetFileDependsOnNETStandard chokes on assembly obfuscated with .NET Reactor, while ResolveAssemblyReferences ...
Read more >
Resolve assembly loads
In most cases, the assembly that is returned by the handler appears in the load context, regardless of the context the handler loads...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found