Version Used:
Microsoft .NET Core SDK 3.1.100 (x64)
Microsoft Visual Studio Community 2019 16.4.2
Steps to Reproduce:
Build the attached project FailedToEmitModule.zip
, or:
- Create a new .NET Core console app
- Add
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.2" /> to the .csproj file
- Copy the following into
Program.cs:
using System;
using Microsoft.Extensions.DependencyInjection;
namespace FailedToEmitModule
{
public static class Program
{
public static void Main()
{
IServiceProvider serviceProvider = null;
var foo = serviceProvider.GetService<>().Foo();
}
}
}
- Build the project
Expected Behavior:
Build error along the lines of:
Program.cs(11,8,11,44): error CS7003: Unexpected use of an unbound generic name
This behaviour can be observed by removing the call to Foo().
Actual Behavior:
Build error:
CSC : error CS7038: Failed to emit module 'FailedToEmitModule'