We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Version Used:
.NET SDK 8.0.100
Steps to Reproduce:
dotnet new console
Program.cs
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);MyInterceptors</InterceptorsPreviewNamespaces
dotnet run
Expected Behavior:
Program runs to completion
Actual Behavior:
InvalidProgramException.
The problem is that Roslyn generates invalid IL
.locals init (valuetype MyEnum V_0) IL_0000: ldc.i4.1 IL_0001: stloc.0 IL_0002: ldloc.0 <- MyEnum is not assignable to Enum in IL! IL_0003: call string MyInterceptors.Interceptors::OtherToString(class [System.Runtime]System.Enum)
using System.Runtime.CompilerServices; var value = MyEnum.Second; Console.WriteLine(value.ToString()); public enum MyEnum { First, Second, } namespace MyInterceptors { public static class Interceptors { [InterceptsLocation(@"C:\repro\Program.cs", line: 4, column: 25)] public static string OtherToString(this System.Enum value) => "Wrong Value" + value; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] sealed class InterceptsLocationAttribute : Attribute { public InterceptsLocationAttribute(string filePath, int line, int column) { } } }
The text was updated successfully, but these errors were encountered:
Originally reported by @andrewlock in dotnet/runtime#57748 (comment):
Sorry, something went wrong.
@RikkiGibson PTAL
RikkiGibson
Successfully merging a pull request may close this issue.
Version Used:
.NET SDK 8.0.100
Steps to Reproduce:
dotnet new console
Program.cs
(adjust full path to match your system)<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);MyInterceptors</InterceptorsPreviewNamespaces
to the .csproj filedotnet run
Expected Behavior:
Program runs to completion
Actual Behavior:
InvalidProgramException.
The problem is that Roslyn generates invalid IL
Program.cs
The text was updated successfully, but these errors were encountered: