Skip to content

Commit 7222a2c

Browse files
authored
Merge branch 'master' into fix-domain-unload
2 parents 02efcdf + 677281e commit 7222a2c

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- Dmitriy Se ([@dmitriyse](https://github.com/dmitriyse))
2929
- He-chien Tsai ([@t3476](https://github.com/t3476))
3030
-   Ivan Cronyn ([@cronan](https://github.com/cronan))
31+
- Jan Krivanek ([@jakrivan](https://github.com/jakrivan))
3132
-   Jeff Reback ([@jreback](https://github.com/jreback))
3233
- Joe Frayne ([@jfrayne](https://github.com/jfrayne))
3334
- John Burnett ([@johnburnett](https://github.com/johnburnett))

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
1919
- Catches exceptions thrown in C# iterators (yield returns) and rethrows them in python ([#475][i475])([#693][p693])
2020
- Implemented GetDynamicMemberNames() for PyObject to allow dynamic object members to be visible in the debugger ([#443][i443])([#690][p690])
2121
- Incorporated reference-style links to issues and pull requests in the CHANGELOG ([#608][i608])
22+
- Added detailed comments about aproaches and dangers to handle multi-app-domains ([#625][p625])
2223

2324
### Changed
2425

@@ -685,4 +686,5 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
685686
[p225]: https://github.com/pythonnet/pythonnet/pull/225
686687
[p78]: https://github.com/pythonnet/pythonnet/pull/78
687688
[p163]: https://github.com/pythonnet/pythonnet/pull/163
689+
[p625]: https://github.com/pythonnet/pythonnet/pull/625
688690
[i131]: https://github.com/pythonnet/pythonnet/issues/131

src/runtime/assemblymanager.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ internal class AssemblyManager
1717
{
1818
// modified from event handlers below, potentially triggered from different .NET threads
1919
// therefore this should be a ConcurrentDictionary
20+
//
21+
// WARNING: Dangerous if cross-app domain usage is ever supported
22+
// Reusing the dictionary with assemblies accross multiple initializations is problematic.
23+
// Loading happens from CurrentDomain (see line 53). And if the first call is from AppDomain that is later unloaded,
24+
// than it can end up referring to assemblies that are already unloaded (default behavior after unload appDomain -
25+
// unless LoaderOptimization.MultiDomain is used);
26+
// So for multidomain support it is better to have the dict. recreated for each app-domain initialization
2027
private static ConcurrentDictionary<string, ConcurrentDictionary<Assembly, string>> namespaces;
28+
2129
//private static Dictionary<string, Dictionary<string, string>> generics;
2230
private static AssemblyLoadEventHandler lhandler;
2331
private static ResolveEventHandler rhandler;

0 commit comments

Comments
 (0)