-
Notifications
You must be signed in to change notification settings - Fork 299
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
Microsoft.Data.SqlClient is not compatible with AssemblyLoadContext unloading #1687
Comments
Thanks for identifying the issue. The MDS team is working on a new release. I believe someone will follow up with this issue as soon as it's out. In the meantime, is there a repro sample that I could use to try? |
I have made some changes to help unloading in the past such as #913 but it needs a specific case to track into and isolate the roots. Without specific guidance on patterns that need to be followed to allow unloadability there's a lot of library to cover. |
@janvorli might have some ideas since he investigated the original bug |
@Wraith2 I've put some guidelines on troubleshooting unloadability issues in the past: https://docs.microsoft.com/en-us/dotnet/standard/assembly/unloadability#troubleshoot-unloadability-issues. I would like to understand what additional details you'd like to get. I'd be happy to provide help with that. |
I've followed the unloadability debugging process using windbg before. What I'm really looking for are design patterns that i can look for in the code which are likely to cause unload problems. Are there know things like timers for example that I can investigate without an example and determine if they need unload support adding. |
The things to look for are:
It is difficult to create an exhaustive list, but these are likely to be the most frequent offenders. |
See dotnet/runtime#31377 for context. The fundamental issue is that unloadability is based on GC references, so SqlClient containing a strong references via event handlers and similar. The suggested fix is that for callbacks like the TimerCallback in Microsoft.Data.SqlClient.SqlConnectionFactory, support for listening to the Unload event could be added and these roots could be cleared, so that the app could be unloaded.
The text was updated successfully, but these errors were encountered: