-1

これはバグなのか、私のミスなのかわかりませんが、コード仮想化が空の値を返した後。

[assembly: Obfuscation(Feature = "Apply to type *: apply to member * when method or constructor: virtualization", Exclude = false)]

namespace ConsoleApp17
{
    class Program
    {
        private static bool valueWritten = false;
        private static int sharedValue = 0;

        private static void ThreadOneStart()
        {
            sharedValue = 1000;
            valueWritten = true;
        }

        private static void ThreadTwoStart()
        {
            if (valueWritten) Console.Write(sharedValue == 1000 ? "Good" : "Bad");
        }

        static void Main(string[] args)
        {
            Thread threadOne = new Thread(ThreadOneStart);
            Thread threadTwo = new Thread(ThreadTwoStart);

            threadOne.Start();
            threadTwo.Start();

            threadOne.Join();
            threadTwo.Join();

            Console.ReadKey();
        }
    }
}
4

1 に答える 1