-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Closed
Copy link
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzers
Milestone
Description
Similar to #96516, but not fixed by #96821. If the instance type is never instantiated, like below, ILLink doesn't keep the default interface implementation provided by IDerived:
Console.WriteLine(M<Instance>());
static int M<T>() where T : IBase {
return T.Value;
}
interface IBase {
static abstract int Value { get; }
}
interface IDerived : IBase {
static int IBase.Value => 1;
}
class Instance : IDerived {
}Trimmed output:
internal interface IBase
{
static abstract int Value { get; }
}
internal class Instance : IBase
{
}The trimmed app crashes with
Unhandled exception. System.TypeLoadException: Virtual static method 'get_Value' is not implemented on type 'Instance' from assembly 'trimmed-app, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at Program.<Main>$(String[])
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzers
Type
Projects
Status
No status