-
Notifications
You must be signed in to change notification settings - Fork 4k
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
"csc.exe" exited with code -2146232797.
using Version 5.0.100-preview.8.20417.9
#47164
Comments
Had the same issue with SDK Seems like using System;
namespace preview_8_console
{
public class Animal { }
public class Cat : Animal { }
public class Dog : Animal
{
public bool IsFunny { get; set; }
public int? JokesCount { get; set; }
}
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine(Pattern(new Dog()));
}
private static string Pattern(Dog dog)
=> dog switch
{
{ IsFunny: false } when dog.JokesCount == null => "this is a regular dog",
{ IsFunny: false } when dog.JokesCount > 0 => "this is a dog with wierd jokes",
{ IsFunny: true } => "this is a funny dog"
};
}
} Seems like problem with @gafter changes inside SwitchExpressionBinder.cs. |
@vladshestel Thank you for tracking the issue down! |
@RikkiGibson @jcouv Here is another crash in recent pattern-matching changes. I suspect this does not affect 16.7. |
@gafter It affects Visual Studio Preview 2019 Version 16.7.2 -- that is the version I used to compile the mentioned code with. |
It is assumed to mean the latest 16.7 patch release, currently 16.7.2. It is surprising that 16.7.1 could present a different behavior than 16.7.2 here--we don't believe that any compiler changes related to this area went in between those releases. |
In the meantime, is it possible to target an older .NET5 preview without having to re-install Visual Studio to an older version? |
You can override the version of the compiler that gets used for builds by following these instructions: https://github.com/dotnet/roslyn/blob/master/docs/compilers/Compiler%20Toolset%20NuPkgs.md |
@RikkiGibson Thanks a lot!! Interestingly enough, I now get a lot of
... though I doubt that it is relevant to the current issue at hand. |
…xit of a decision dag in the face of multiple when clauses, for the purpose of constructing the "not exhaustive" diagnostic. Fixes dotnet#47164
The issue still exists in |
@Unknown6656 Yes, that's likely. RC1 predates this fix. |
@jcouv: Oh ok, I did not know that. Thanks ^^ |
@RikkiGibson I tested it again with the NuGet Release
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5</TargetFramework>
<LangVersion>latest</LangVersion>
[...]
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.8.0-3.final">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
[...] Error:
|
Try using a nightly preview4 build such as https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&package=Microsoft.Net.Compilers.Toolset&protocolType=NuGet&version=3.8.0-4.20472.6&view=overview |
@RikkiGibson : THanks a lot! You just saved my day! |
So when i try to compile a script with <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.9.0-5.final" /> var income = 900m;
var res = income switch
{
< 9876 => 0 + (0.10m * (income - 0m)),
< 40126 => 987.5m + (0.12m * (income - 9875m)),
< 85126 => 4617.5m + (0.22m * (income - 40125m)),
< 163301 => 14605.5m + (0.24m * (income - 85252m)),
< 207351 => 33271.5m + (0.32m * (income - 163300m)),
< 518401 => 47367.5m + (0.35m * (income - 207350m)),
_ => 156235m + (0.37m * (income - 518400m))
};
Console.WriteLine($"Owned: {res}"); I get
While executing this line: var compileResult = await compilation.GetAllDiagnosticsAsync(); |
Cross Posted in: #49529 (comment) |
Version Used:
Steps to Reproduce:
This may be reproducable by cloning https://github.com/Unknown6656/Unknown6656.Core and trying to build the project
/Unknown6656.Core/Unknown6656.Core.csproj
using the .NET Core SDK version 5.0.100-preview.8.20417.9Expected Behavior:
No crash of
csc.exe
(at least, it did not crash on version 5.0.100-preview.7.20366.6)Actual Behavior:
(I'm so sorry for the wall of text)
The text was updated successfully, but these errors were encountered: