Commit 03c2272
authored
[jnimarshalmethod-gen] Fix type resolution crash (#706)
The TypeMover was crashing, when we cannot resolve the type during
register method optimization.
Like this:
Value cannot be null.
Parameter name: key
System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) [0x00175] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/debug/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:470
at System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/debug/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:286
at Xamarin.Android.Tools.JniMarshalMethodGenerator.TypeMover.Resolve (Mono.Cecil.TypeReference type) [0x00001] in /Users/rodo/git/xa-clean/external/Java.Interop/tools/jnimarshalmethod-gen/TypeMover.cs:143
at Xamarin.Android.Tools.JniMarshalMethodGenerator.TypeMover.GetActionConstructor (Mono.Cecil.TypeReference type, Mono.Cecil.ModuleDefinition module) [0x00012] in /Users/rodo/git/xa-clean/external/Java.Interop/tools/jnimarshalmethod-gen/TypeMover.cs:335
at Xamarin.Android.Tools.JniMarshalMethodGenerator.TypeMover.AnalyzeAndImprove (Mono.Collections.Generic.Collection`1[T] instructions, Mono.Collections.Generic.Collection`1[T] newInstructions, System.Int32 idx, System.String typeName, System.Int32& skipCount, Mono.Cecil.ModuleDefinition module) [0x003b6] in /Users/rodo/git/xa-clean/external/Java.Interop/tools/jnimarshalmethod-gen/TypeMover.cs:417
The tool was crashing on IL like this:
IL_0122: ldstr "Delegate18$1"
IL_0127: ldc.i4.1
IL_0128: call [mscorlib]System.Type [mscorlib]System.Type::GetType(string,
bool)
The fix makes us more error resistant. It doesn't fix the source of the problem,
which will be fixed elsewhere.
More information about the issue which led to the crash: #7091 parent ac914ce commit 03c2272
1 file changed
+19
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
400 | 402 | | |
401 | 403 | | |
402 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
403 | 414 | | |
404 | 415 | | |
405 | 416 | | |
| |||
516 | 527 | | |
517 | 528 | | |
518 | 529 | | |
519 | | - | |
| 530 | + | |
520 | 531 | | |
521 | | - | |
| 532 | + | |
522 | 533 | | |
523 | 534 | | |
524 | 535 | | |
525 | | - | |
526 | | - | |
527 | | - | |
| 536 | + | |
| 537 | + | |
528 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
529 | 542 | | |
530 | 543 | | |
531 | 544 | | |
| |||
0 commit comments