.NET 10 problem

public static class Repro
{
    [Obfuscation(Feature = "virtualization", Exclude = false)]
    public static string TwoSites()
    {
        return Repro.Build(new DefaultInterpolatedStringHandler(0, 0)) + Repro.Build(new DefaultInterpolatedStringHandler(0, 0));
    }

    private static string Build(DefaultInterpolatedStringHandler handler)
    {
        return handler.ToStringAndClear();
    }
}


    public static class Repro
    {
        [Obfuscation(Feature = "virtualization", Exclude = false)]
        public static void TimerCallback(object state)
        {
            try
            {
                Log($"retryCount={1}");
                Log($"period={2}");
            }
            catch (Exception)
            {
            }
        }

        private static void Log(object message)
        {
        }
    }
   TimerCallbackRepro.csproj
    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <AssemblyName>VmpTimerCallbackRepro</AssemblyName>
        <ImplicitUsings>disable</ImplicitUsings>
        <Nullable>disable</Nullable>
        <Optimize>true</Optimize>
      </PropertyGroup>
    </Project>

{ “sdk”: { “version”: “8.0.303”, “rollForward”: “disable” } }

results [Error] Invalid param index

VMProtect Ultimate 3.11.0 build 2837

when virtualizing a single method that contains two newobj instructions referencing the same non-generic
ref-struct constructor token (e.g. System.Runtime.CompilerServices.DefaultInterpolatedStringHandler::.ctor(int32,int32), emitted by C# $“…” strings written inside a try block),

new forum can’t upload zip file~

Please try to attach ZIP file again.

Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif, heic, heif, webp, avif, svg, jxl, go).

i renamed it to go

vmp_tmp2.zip.go (3.5 KB)

, please remove .go

Hello, string encrypt is not thread safe on build 2837. It was thread safe on old version

(.net 4.8)

    using System;
    using System.Reflection;
    using System.Runtime.Versioning;
    using System.Threading;

    [assembly: AssemblyVersion("1.0.0.0")]
    [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

    namespace VmpRepro
    {
        public static class Wrapper
        {
            [Obfuscation(Feature = "strings", Exclude = false)]
            public static string StringsA()
            {
                return "AAAA";
            }
        }

        internal static class Program
        {
            private static void Main()
            {
                ManualResetEventSlim go = new ManualResetEventSlim(false);

                Thread t1 = new Thread(() =>
                {
                    go.Wait();
                    for (int i = 0; i < 2000; i++)
                        Wrapper.StringsA();
                });

                Thread t2 = new Thread(() =>
                {
                    go.Wait();
                    for (int i = 0; i < 2000; i++)
                        Wrapper.StringsA();
                });

                t1.Start();
                t2.Start();
                go.Set();
                t1.Join();
                t2.Join();
                Console.WriteLine("DONE");
            }
        }
    }

    internal static class Program
    {
        private static void Main(string[] args)
        {
            int iters = args.Length > 0 ? int.Parse(args[0]) : 2000;
            int threads = args.Length > 1 ? int.Parse(args[1]) : 2;
            Console.WriteLine("iters=" + iters + " threads=" + threads);

            if (threads == 1)
            {
                int ok = 0;
                for (int i = 0; i < iters; i++)
                {
                    Wrapper.StringsA();
                    ok++;
                }
                Console.WriteLine("OK=" + ok);
                return;
            }

            ManualResetEventSlim start = new ManualResetEventSlim(false);
            Task[] tasks = new Task[threads];
            for (int t = 0; t < threads; t++)
            {
                tasks[t] = Task.Factory.StartNew(() =>
                {
                    start.Wait();
                    for (int i = 0; i < iters; i++)
                        Wrapper.StringsA();
                });
            }
            start.Set();
            Task.WaitAll(tasks);
            Console.WriteLine("DONE");
        }
    }
}

1  System.AccessViolationException
2  System.OverflowException

Thank you.