dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.05k stars 4.04k forks source link

Microsoft.CSharp.Core.targets(58,5): error MSB6006: "csc.exe" exited with code -2146232797. #34912

Closed JohnGalt1717 closed 5 years ago

JohnGalt1717 commented 5 years ago

Version Used: 2.2.203 .NET Core VS.NET 2019 16.0

Steps to Reproduce:

  1. Build project
  2. Observe error in output

Here's my CSProj:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>netcoreapp2.2</TargetFramework>
        <DebugType>portable</DebugType>
        <LangVersion>8.0</LangVersion>
        <NullableReferenceTypes>true</NullableReferenceTypes>
        <NullableContextOptions>enable</NullableContextOptions>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="AspNet.Security.OpenIdConnect.Extensions" Version="2.0.0" />
        <PackageReference Include="AspNet.Security.OpenIdConnect.Primitives" Version="2.0.0" />
        <PackageReference Include="AspNet.Security.OpenIdConnect.Server" Version="2.0.0" />
        <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
        <PackageReference Include="DocumentFormat.OpenXml" Version="2.9.1" />
        <PackageReference Include="DocxToHtml" Version="1.0.4" />
        <PackageReference Include="EPPlus" Version="4.5.3.1" />
        <PackageReference Include="FileHelpers" Version="3.4.0" />
        <PackageReference Include="Mammoth" Version="1.4.0" />
        <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.6.1" />
        <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
        <PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.3.0" />
        <PackageReference Include="Microsoft.Azure.Management.AppService.Fluent" Version="1.20.0" />
        <PackageReference Include="Microsoft.Azure.Management.Dns.Fluent" Version="1.20.0" />
        <PackageReference Include="Microsoft.Azure.Management.Fluent" Version="1.20.0" />
        <PackageReference Include="Microsoft.Azure.Search" Version="5.0.3" />
        <PackageReference Include="Microsoft.Graph" Version="1.14.0" />
        <PackageReference Include="Sendgrid" Version="9.10.0" />
        <PackageReference Include="System.Reactive.Linq" Version="4.1.5" />
        <PackageReference Include="System.Threading" Version="4.3.0" />
        <PackageReference Include="unofficial.windowsazure.mediaservices" Version="4.1.0.1" />
        <PackageReference Include="unofficial.windowsazure.mediaservices.extensions" Version="4.1.0.1" />
        <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
    </ItemGroup>

    <ItemGroup>
        <ProjectReference Include="..\XXX.Data\XXX.Data.csproj" />
        <ProjectReference Include="..\TinCan\TinCan.csproj" />
    </ItemGroup>

    <ItemGroup>
        <Compile Update="Properties\Resources.Designer.cs">
            <DesignTime>True</DesignTime>
            <AutoGen>True</AutoGen>
            <DependentUpon>Resources.resx</DependentUpon>
        </Compile>
    </ItemGroup>

    <ItemGroup>
        <EmbeddedResource Update="Properties\Resources.resx">
            <Generator>ResXFileCodeGenerator</Generator>
            <LastGenOutput>Resources.Designer.cs</LastGenOutput>
        </EmbeddedResource>
    </ItemGroup>

</Project>

Expected Behavior:

Should build normally like dotnet.exe does.

Actual Behavior:

Crashes with this in the output: Microsoft.CSharp.Core.targets(58,5): error MSB6006: "csc.exe" exited with code -2146232797.

gafter commented 5 years ago

We need either your whole project, or a complete self-contained repro. Or a crash dump.

JohnGalt1717 commented 5 years ago

Please provide instructions for how to create the crash dump.

agocke commented 5 years ago

https://docs.microsoft.com/en-us/windows/desktop/wer/collecting-user-mode-dumps should help. The process we care about is called "VBCSCompiler.exe"

JohnGalt1717 commented 5 years ago

Sorry for the delay. I have the files, but given it might contain senstitive information about my computer and work, I'd rather not just post it here. Who can I send a OneDrive link to?

JohnGalt1717 commented 5 years ago

Bump...

JohnGalt1717 commented 5 years ago

Some more information:

If I use SDK 2.2.106 it builds fine.

If I use SDK 2.2.203 it fails with the above and this detail when using dotnet.exe to build it: Unexpected value 'Beq' of type 'System.Reflection.Metadata.ILOpCode'

The machine is a brand new Windows 10 machine fully patched with ONLY VS.net 2019 on it. I installed 2.2.106 manually from dot.net to test.

Hopefully that issolates the actual issue.

JohnGalt1717 commented 5 years ago

And, even using .106 with VS.net 2019 you still get the same error.

ldy985 commented 5 years ago

We are having a similar issue. I have reduced the code as much as possible here: ClassLibrary1.zip

I'am unable to collect dumps for "VBCSCompiler.exe" but I collected for "dotnet.exe" if that is of any help ClassLibrary1Dump.zip

Edit: Managed to get a dump of VBCSCompiler. VBCSCompiler.dmp.zip

JohnGalt1717 commented 5 years ago

@ldy985 thanks for the repro!

I can confirm that in docker running dotnet publish, it works fine in 2.2.105 of the SDK but breaks with 2.2.106 of the SDK.

This should be straight forward to figure out what broke it.

gafter commented 5 years ago

This was fixed in https://github.com/dotnet/roslyn/pull/34791

JohnGalt1717 commented 4 years ago

This isn't fixed. Just had it happened with 2.2.207 (I know, not supported but we're screwed because of the disaster that is ef core 3.x.)

gafter commented 4 years ago

@JohnGalt1717 Do you believe that #34971 is included in 2.2.207?

JohnGalt1717 commented 4 years ago

@gafter I'm not sure because of the phycotic nature of the numbering scheme for 2.2.x releases of the SDK, but according to the 2.2 SDK homepage for downloads 2.2.207 is the most recent release. (and the alternative 2.2.110 listed in the same release area doesn't have a docker image)