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
For years I've wondered why assembly load failures cannot be improved so that the caller can get at the hierarchy of assemblies that were involved when the eventual bad load actually fails.
The unhelpful exception message we've all seen is (for example)
Could not load file or assembly 'Microsoft.Practices.Unity, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
It is actually a System.IO.FileNotFoundException but ideally should be a dedicated exception (e.g. AssemblyNotFoundException).
That particular exception could then have a property, a simple list/stack of all of the assemblies in the hierarchy at the time the problem assembly was discovered to be missing. This would be a huge help especially for large systems.
Will the CORE team consider something likes this for .Net Core?
We are looking into improving the error messages around assembly loads. I'll add this one to the list.
We do plan to add the name of the assembly which caused the load to happen (if available).
I'm wondering if you have a scenario in mind where a full stack of assemblies is needed. Note that the full stack is somewhat tricky as it can be very spread in time (the root is always the app assembly which is loaded first, so it could be quite a while ago).
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.
Activity
jkotas commentedon Oct 19, 2018
cc @vitek-karas
vitek-karas commentedon Oct 22, 2018
We are looking into improving the error messages around assembly loads. I'll add this one to the list.
We do plan to add the name of the assembly which caused the load to happen (if available).
I'm wondering if you have a scenario in mind where a full stack of assemblies is needed. Note that the full stack is somewhat tricky as it can be very spread in time (the root is always the app assembly which is loaded first, so it could be quite a while ago).
vitek-karas commentedon Feb 10, 2021
Unfortunately not much progress on exception messages, but there's now detailed tracing for this purpose: https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/collect-details
dotnet-policy-service commentedon Aug 13, 2025
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
This process is part of our issue cleanup automation.
dotnet-policy-service commentedon Aug 27, 2025
This issue will now be closed since it had been marked
no-recent-activitybut received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.