Repository navigation
Closed
Description
Description
Type.GetInterfaceMap returns null entries for TargetMethods sometimes.
Test case:
consoleapp-3c50b29.zip
Repro:
- Install .NET 6.0.100-preview.6.21308.62
- Download & extract test case
- Run the
run-with-mono.shscript
$ ./run-with-mono.sh
+ DOTNET=dotnet
+ dotnet publish -r osx-x64 /p:UseMonoRuntime=true
Microsoft (R) Build Engine version 17.0.0-preview-21304-01+a5ea6d2ca for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored /Users/rolf/test/dotnet/consoleapp/myproject.csproj (in 93 ms).
You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
myproject -> /Users/rolf/test/dotnet/consoleapp/bin/Debug/net6.0/osx-x64/myproject.dll
myproject -> /Users/rolf/test/dotnet/consoleapp/bin/Debug/net6.0/osx-x64/publish/
+ MONO_ENV_OPTIONS=--version
+ ./bin/Debug/net6.0/osx-x64/publish/myproject
Mono JIT compiler version 6.0.0.0 (6.0.21.30601 @Commit: 5b8e1780ad7740e632c285bc2af13a8d0b20c5a9)
Copyright (C) Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS:
SIGSEGV: normal
Notification: kqueue
Architecture: amd64
Disabled:
Misc: softdebug
Interpreter: yes
LLVM: supported, not enabled.
Suspend: hybrid
GC: sgen (concurrent by default)
+ ./bin/Debug/net6.0/osx-x64/publish/myproject Xamarin.Mac.dll
Running on .NET 6.0.0-preview.6.21306.1
Loading: /Users/rolf/test/dotnet/consoleapp/Xamarin.Mac.dll
Got interface map for type CoreBluetooth.CBCentralManagerDelegate and interface CoreBluetooth.ICBCentralManagerDelegate with 1 entries:
1 Void UpdatedState(CoreBluetooth.CBCentralManager) -> null
Compare to when running with .NET:
$ dotnet run *.dll
Running on .NET 6.0.0-preview.6.21306.1
Loading: /Users/rolf/test/dotnet/consoleapp/Xamarin.Mac.dll
Got interface map for type CoreBluetooth.CBCentralManagerDelegate and interface CoreBluetooth.ICBCentralManagerDelegate with 1 entries:
1 Void UpdatedState(CoreBluetooth.CBCentralManager) -> Void UpdatedState(CoreBluetooth.CBCentralManager)
Configuration
.NET 6.0.100-preview.6.21308.62
Regression?
Yes (since 6.0.100-preview.6.21280.2).
Other information
Our tests ran into this when bumping to the latest .NET version (dotnet/macios#11852).
Looking at the dotnet/runtime commits since it worked, there's a possible cause here: 5d64814 (CC @bholmes).
Activity
akoeplinger commentedon Jun 9, 2021
/cc @lambdageek looks like a regression most likely from #52566
CoffeeFlux commentedon Jun 9, 2021
cc: @bholmes
marek-safar commentedon Jun 9, 2021
/cc @SamMonoRT
lambdageek commentedon Jun 9, 2021
Here's the repro (.NET 6 Preview 4, using CoreCLR):
Should Print
Mono prints
bholmes commentedon Jun 9, 2021
I suspect that I did not cover the case when the found target method is abstract, but is on an a class.
I think a check needs to be added here to ensure that the found method is an interface.
However I am still trying to understand why the 4th case provided above returns null.
bholmes commentedon Jun 9, 2021
Lines 106 and 111.
runtime/src/tests/reflection/DefaultInterfaceMethods/GetInterfaceMapConsumer.cs
Lines 103 to 112 in ac87f00
lambdageek commentedon Jun 9, 2021
@bholmes here's what I have so far
I'm trying to add some tests to the testsuite to cover this.
There's another case that is also annoying (and responsible for the
method_is_dimcase above):Calling
GetInterfaceMaponLwith interfacesI5orI3the target method isnull. Calling it onLwithI4returns the unabstracted method fromI4, calling it onLwithIDreturns the method fromL.3 remaining items
Add DIM tests for GetInterfaceMap
Return null target methods from GetInterfaceMap in fewer cases
Don't return null target methods in GetInterfaceMap for abstract clas…
lambdageek commentedon Jun 15, 2021
Need to fix this in mono/mono, too
Don't return null target methods in GetInterfaceMap for abstract clas…
Don't return null target methods in GetInterfaceMap for abstract clas…