SharpLab icon indicating copy to clipboard operation
SharpLab copied to clipboard

DefaultInterpolatedStringHandler throws VerificationException in Run mode

Open JakeYallop opened this issue 6 months ago • 0 comments

sharplab

using System.Runtime.CompilerServices;

Test($"{123}");    
Test($"""{123}""");

static void Test(ref DefaultInterpolatedStringHandler expected)
{
}

The above code throws a VerificationException when in Run mode:

System.Security.VerificationException: Method SharpLab.Runtime.Internal.Flow.ReportRefValue: type argument 'System.Runtime.CompilerServices.DefaultInterpolatedStringHandler' violates the constraint of type parameter 'T'.
   at Program.<<Main>$>g__Test|0_0(DefaultInterpolatedStringHandler& expected)
   at Program.<Main>$(String[] args)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)

However, the code compiles (and execute just fine using something other than sharplab).

JakeYallop avatar Aug 22 '24 17:08 JakeYallop