Commit b3ee0f2
[release/9.0.1xx] [ObjCRuntime] Ensure all assemblies' module constructors have executed before failing registrar lookup. (#21891)
The managed static registrar depends on each assembly registering itself
to
find types from that assembly. This is done using a module constructor,
but
the module constructor isn't necessarily executed before the managed
static
registrar needs the assembly registered (in particular for app
extensions,
which don't have a managed entry point).
That would lead to exceptions like this:
*** Terminating app due to uncaught exception
'ObjCRuntime.RuntimeException', reason: 'Could not find the type
'ObjCRuntime.__Registrar__' in the assembly '...'.
(ObjCRuntime.RuntimeException)
at ObjCRuntime.RegistrarHelper.GetMapEntry(String assemblyName)
at ObjCRuntime.RegistrarHelper.GetMapEntry(Assembly assembly)
[...]
Fix this by manually calling the module constructor for every loaded
assembly
if we can't find it in the map of registered assemblies.
Backport of #21885
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>1 parent c29b554 commit b3ee0f2
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
105 | 124 | | |
106 | 125 | | |
107 | 126 | | |
| |||
0 commit comments