-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Milestone
Description
Description
Repro:
using System;
using System.Reflection;
namespace Test;
class Program
{
static void Main()
{
Activator.CreateInstance(Type.GetType("Test.Foo+Bar`1").MakeGenericType(typeof(int)));
}
}
class Foo
{
class Bar<T> { public Bar() { Console.WriteLine("ok"); } }
}csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<IlcOptimizationPreference>Speed</IlcOptimizationPreference>
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
<TrimMode>Link</TrimMode>
<TrimmerDefaultAction>link</TrimmerDefaultAction>
<IlcTrimMetadata>true</IlcTrimMetadata>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-*" />
</ItemGroup>
</Project>Reproduction Steps
- Build with
dotnet publish -c Release -r win-x64 - Run
bin\Release\net7.0\win-x64\publish\Test.exe
Expected behavior
The exception message should be:
Unhandled Exception: System.Reflection.MissingMetadataException: 'Test.Foo+Bar`1[System.Int32]' is missing metadata. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=392859
Actual behavior
Unhandled Exception: System.Reflection.MissingMetadataException: 'Test.Foo.Bar<System.Int32>' is missing metadata. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=392859
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
This would help developers to identify the missing types easier.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status