Esempio n. 1
0
        public void DisableReadyToRun()
        {
#if NETCOREAPP2 || NETCOREAPP3_0
            return;
#endif
            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                return;
            }

            MethodBase clampMethod = typeof(Math).GetMethod("Clamp", new[] { typeof(int), typeof(int), typeof(int) });
            bool       disabled    = MethodHelper.DisableReadyToRun(clampMethod);

            Assert.True(disabled);

            bool isClampCompiled = false;

            JitexManager.AddMethodResolver(context =>
            {
                if (context.Method.Name == clampMethod.Name)
                {
                    isClampCompiled = true;
                }
            });

            Math.Clamp(1, 1, 1);

            Assert.True(isClampCompiled, "Method was not compiled.");
        }