You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Better error handling when DLL cannot be loaded due to missing reference #2566
We recently added a couple of new references to our DLL which caused one of our DLLs to stop loading. We were really confused as to why since nothing has really changed other than the references. And we have generally not had to add reference previously either.
And this ModuleNotFoundError is really vague as to why it's failing. I would also say it's misguiding the user on what the actual issue which is the lack of references to a missing module that it has no access to and needs to be added.
Let's say I have a .csproj DLL that I'm referencing called HelloWorld.csproj and has references reference1 and reference2.
Since I didn't add a reference to import reference1.dll and reference2.dll it is failing to load my HelloWorld.csproj giving me a ModuleNotFoundError.
I think the best thing to do in this scenario is to highlight the fact that the DLL is unable to be loaded because of the missing modules since if we manually add the references the issue is fixed like clr.addReference(reference1) and clr.addReference(reference2).
Yeah this needs some work. I had a problem with upgrading dotnet and then it just stopped loading dlls and it was claiming that the file was missing which sent me on a wild goose chase trying to figure out why it couldn't see the file. Never actually did solve the problem. Removing .net9 and .net10 did get things working again, but "file missing" really doesn't give any clues about why pythonnet thinks cant load them dlls anymore, at least on linux (maybe problem also on windows?)
Activity
shayneoneill commentedon Mar 29, 2026
Yeah this needs some work. I had a problem with upgrading dotnet and then it just stopped loading dlls and it was claiming that the file was missing which sent me on a wild goose chase trying to figure out why it couldn't see the file. Never actually did solve the problem. Removing .net9 and .net10 did get things working again, but "file missing" really doesn't give any clues about why pythonnet thinks cant load them dlls anymore, at least on linux (maybe problem also on windows?)
Latency commentedon Apr 11, 2026
Same issue here! net9.0 & net10.0 fail. Desktop 4.8.1 works. Go figure! Same code.. w/ associative pathing. shrugs Definatly bugged!