Description
The following code:
foreach (var type in typeof (NSObject).Assembly.GetTypes ()) {
if (!type.IsSubclassOf (typeof (NSObject)))
continue;
// ...
}
Now throws:
System.TypeLoadException : The type 'AudioToolbox.MidiRawData' cannot be found in assembly 'Microsoft.MacCatalyst, Version=17.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.
at System.Reflection.Runtime.General.TypeResolver.Resolve(QTypeDefRefOrSpec, TypeContext) + 0x5c
at System.Reflection.Runtime.TypeInfos.RuntimeTypeInfo.get_BaseTypeWithoutTheGenericParameterQuirk() + 0xa8
at System.Reflection.Runtime.TypeInfos.RuntimeTypeInfo.get_BaseType() + 0xa4
at System.RuntimeType.get_BaseType() + 0x10c
at System.Type.IsSubclassOf(Type) + 0x84
and yes, there's a trimmer warning:
Trim analysis warning IL2026: Using member 'System.Reflection.Assembly.GetTypes()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Types might be removed.
but this seems like a weird failure, I would expect types to be removed, but still be able to work with types that aren't.
Reproduction Steps
Repro created with --make-repro-path:
3827741034_monotouchtest.zip
Expected behavior
No exception
Actual behavior
Exception.
Regression?
Yes, in here somewhere: 34bf55c...a26802a
This showed up in one of our test suites in a maestro bump: dotnet/macios#19539
Known Workarounds
No response
Configuration
No response
Other information
No response
Description
The following code:
Now throws:
and yes, there's a trimmer warning:
but this seems like a weird failure, I would expect types to be removed, but still be able to work with types that aren't.
Reproduction Steps
Repro created with --make-repro-path:
3827741034_monotouchtest.zip
Expected behavior
No exception
Actual behavior
Exception.
Regression?
Yes, in here somewhere: 34bf55c...a26802a
This showed up in one of our test suites in a maestro bump: dotnet/macios#19539
Known Workarounds
No response
Configuration
No response
Other information
No response