Bug 43696

Summary: Delegate caching can invoke unrelated implementation leading to strange results
Product: [Mono] Runtime Reporter: Marek Safar <masafa>
Component: JITAssignee: Zoltan Varga <vargaz>
Status: RESOLVED FIXED    
Severity: major CC: andi.mcclure, mono-bugs+mono, mono-bugs+runtime
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description Marek Safar 2016-08-24 08:54:16 UTC
1. git clone and build this mono tree https://github.com/marek-safar/mono/tree/roslyn
2. go to mcs/tests
3. make check

test-async-06.cs...	REGRESSION (SUCCESS -> EXECUTION ERROR)
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at (wrapper delegate-invoke) System.Func`2[Mono.CSharp.InflatedTypeSpec,Mono.CSharp.TypeParameterInflator]:invoke_TResult_T (Mono.CSharp.InflatedTypeSpec)
  at Program.Main () [0x001b3] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/tests/test-async-06.cs:91 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <51e9c2c41f0f4624a7e740315384a6cf>:0 
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <51e9c2c41f0f4624a7e740315384a6cf>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <51e9c2c41f0f4624a7e740315384a6cf>:0 
  at TestRunner.PositiveChecker+DomainTester.ExecuteFile (System.Reflection.MethodInfo entry_point, System.String filename) [0x00034] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/tools/compiler-tester/compiler-tester.cs:905
Comment 1 Zoltan Varga 2016-08-29 22:28:09 UTC
This seems to only happen when using make check, it doesn't happen when running the compiled .exe.
Comment 2 Zoltan Varga 2016-08-29 22:47:02 UTC
MONO_ENV_OPTIONS=-O=-aot also seems to fix it, so this might be an aot problem.
Comment 3 Zoltan Varga 2016-08-31 22:26:18 UTC
Should be fixed by mono master 02ffe591f78fe4f19098c0926e9f15f0c5fe7c2d.