Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with error CS8751: Internal error in the C# compiler #994

Closed
alevincenzi opened this issue Apr 14, 2020 · 5 comments
Closed
Milestone

Comments

@alevincenzi
Copy link

alevincenzi commented Apr 14, 2020

Hello.
Building the solution from a clean project, after a checkout of the master branch, fails with these three errors in the test project:

1>------ Build started: Project: Moq, Configuration: Debug Any CPU ------
2>------ Build started: Project: Moq.Tests.FSharpTypes, Configuration: Debug Any CPU ------
2>Moq.Tests.FSharpTypes -> C:\DEV\moq4\tests\Moq.Tests.FSharpTypes\bin\Debug\net472\Moq.Tests.FSharpTypes.dll
2>Moq.Tests.FSharpTypes -> C:\DEV\moq4\tests\Moq.Tests.FSharpTypes\bin\Debug\netcoreapp2.2\Moq.Tests.FSharpTypes.dll
1>Moq -> C:\DEV\moq4\src\Moq\bin\Debug\net45\Moq.dll
1>Moq -> C:\DEV\moq4\src\Moq\bin\Debug\netstandard2.0\Moq.dll
3>------ Build started: Project: Moq.Tests, Configuration: Debug Any CPU ------
4>------ Build started: Project: Moq.Tests.VisualBasic, Configuration: Debug Any CPU ------
4>Moq.Tests.VisualBasic -> C:\DEV\moq4\tests\Moq.Tests.VisualBasic\bin\Debug\net472\Moq.Tests.VisualBasic.dll
3>C:\DEV\moq4\tests\Moq.Tests\ComCompatibilityFixture.cs(86,57,86,73): error CS8751: Internal error in the C# compiler.
3>C:\DEV\moq4\tests\Moq.Tests\ComCompatibilityFixture.cs(93,57,93,73): error CS8751: Internal error in the C# compiler.
3>C:\DEV\moq4\tests\Moq.Tests\ComCompatibilityFixture.cs(101,57,101,73): error CS8751: Internal error in the C# compiler.
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(31,16,31,29): warning CS0183: The given expression is always of the provided ('int?') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(39,16,39,31): warning CS0183: The given expression is always of the provided ('object') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(47,17,47,30): warning CS0184: The given expression is never of the provided ('long') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(55,17,55,29): warning CS0184: The given expression is never of the provided ('int') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(63,17,63,30): warning CS0184: The given expression is never of the provided ('uint') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(79,17,79,32): warning CS0184: The given expression is never of the provided ('int?[]') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(95,17,95,34): warning CS0184: The given expression is never of the provided ('object[]') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(103,17,103,32): warning CS0184: The given expression is never of the provided ('uint[]') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(119,16,119,36): warning CS0183: The given expression is always of the provided ('IComparable') type
3>C:\DEV\moq4\tests\Moq.Tests\Regressions\IssueReportsFixture.cs(2997,33,2997,34): warning CS0067: The event 'IssueReportsFixture.Issue893.A.E' is never used
3>Done building project "Moq.Tests.csproj" -- FAILED.
4>Moq.Tests.VisualBasic -> C:\DEV\moq4\tests\Moq.Tests.VisualBasic\bin\Debug\netcoreapp2.2\Moq.Tests.VisualBasic.dll
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(31,16,31,29): warning CS0183: The given expression is always of the provided ('int?') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(39,16,39,31): warning CS0183: The given expression is always of the provided ('object') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(47,17,47,30): warning CS0184: The given expression is never of the provided ('long') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(55,17,55,29): warning CS0184: The given expression is never of the provided ('int') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(63,17,63,30): warning CS0184: The given expression is never of the provided ('uint') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(79,17,79,32): warning CS0184: The given expression is never of the provided ('int?[]') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(95,17,95,34): warning CS0184: The given expression is never of the provided ('object[]') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(103,17,103,32): warning CS0184: The given expression is never of the provided ('uint[]') type
3>C:\DEV\moq4\tests\Moq.Tests\Matchers\IsAssignableFromVsIsOperatorFixture.cs(119,16,119,36): warning CS0183: The given expression is always of the provided ('IComparable') type
3>C:\DEV\moq4\tests\Moq.Tests\Regressions\IssueReportsFixture.cs(2997,33,2997,34): warning CS0067: The event 'IssueReportsFixture.Issue893.A.E' is never used
3>Moq.Tests -> C:\DEV\moq4\tests\Moq.Tests\bin\Debug\netcoreapp2.2\Moq.Tests.dll
3>Done building project "Moq.Tests.csproj".
========== Build: 3 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

In detail, the compiler errors show up in the usage of the interface IHasIndexer in these three lines:

var indexer = typeof(IHasIndexer).GetProperty(nameof(IHasIndexer.Item));

The interface resolves to: Moq.Tests.ComTypes.IHasIndexer but it gives the internal compiler error.

I run the build from:

Microsoft Visual Studio Community 2019
Version 16.5.3
VisualStudio.16.Release/16.5.3+30002.166
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Community

Azure App Service Tools v3.0.0   16.5.236.49856
C# Tools   3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e
Common Azure Tools   1.10
IntelliCode Extension   1.0
Microsoft JVM Debugger   1.0
Microsoft MI-Based Debugger   1.0
NuGet Package Manager   5.5.0
ProjectServicesPackage Extension   1.0
Visual Basic Tools   3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e
Visual F# Tools 10.8.0.0 for F# 4.7   16.5.0-beta.20181.6+85af456066acd4e76d2bc7821b44a325e46f2fca
Microsoft Visual F# Tools 10.8.0.0 for F# 4.7
Visual Studio Code Debug Adapter Host Package   1.0

The dotnet --info from a console on my system (Windows 10) gives

.NET Core SDK (reflecting any global.json):
 Version:   3.1.201
 Commit:    b1768b4ae7

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.201\

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  2.1.805 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
@stakx
Copy link
Contributor

stakx commented Apr 14, 2020

Hi @alevincenzi, thanks for reporting. I noticed the same thing just yesterday and reported this to the C# compiler team at dotnet/roslyn#43318... let's see what they say.

@alevincenzi
Copy link
Author

Nice, @stakx . Thank you for the quick reply.
Any workaround to have my local copy build?

@stakx
Copy link
Contributor

stakx commented Apr 14, 2020

Any workaround to have my local copy build?

  1. Comment out / remove the tests where the errors occur.
  2. Unload / remove the whole test project.
  3. Use Visual Studio 2017.

@alevincenzi
Copy link
Author

Ok, sure, I meant except removing the tests.
Fine for me. Thanks.

stakx added a commit that referenced this issue Apr 14, 2020
Build fails with error CS8751: Internal error in the C# compiler:
#994
@stakx
Copy link
Contributor

stakx commented Apr 14, 2020

@alevincenzi, I removed the problematic nameof instances. If you pull the latest commit on master, you should be able to compile now.

@stakx stakx closed this as completed Apr 14, 2020
@stakx stakx added this to the 4.14.0 milestone Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants