[Bug 32316] Autodesk 3ds Max 9 32-bit exits silently or crashes on startup with Wine-Mono

WineHQ Bugzilla wine-bugs at winehq.org
Mon Dec 14 16:46:41 CST 2020


https://bugs.winehq.org/show_bug.cgi?id=32316

--- Comment #19 from Bruni <earns.61 at gmail.com> ---
Anastasius
Thank you for your hard work!

Got a working test case.

The essense is that the bug can be unvealed by detecting the method name which
threw exceptions when AddEventHandler was called with null target parameter.

There is clear difference between Mono and .NET behavior - the former throw
Exception in CreateAddEventDelegate whereas the latter do it in Invoke method.

Compiled with Microsoft csc.exe, it prints "testcase passed"
Compiled and run by means of Mono, it prints "testcase failed" and stops
running.

using System;
using System.Text;
using System.Reflection;
using System.Diagnostics;

namespace AddEventHandlerTestCase
{
    class Program
    {
        public event Func<string> TestEvent;

        public string TestMethod()
        {
            return "Hello World";
        }

        public void Test()
        {
            if (TestEvent != null)
                Console.WriteLine(TestEvent());
        }

        static void Main(string[] args)
        {
            var p = new Program();
            EventInfo eventInfo = p.GetType().GetEvent("TestEvent");
            var methodInfo = p.GetType().GetMethod("TestMethod");
            Delegate handler =
Delegate.CreateDelegate(eventInfo.EventHandlerType, p, methodInfo);
            try
            {
                eventInfo.AddEventHandler(null, handler);

            }
            catch (Exception e)
            {
                if
(!e.StackTrace.Contains("System.Reflection.RuntimeMethodInfo.Invoke"))
                {
                    Console.WriteLine("testcase failed");
                    Debugger.Break();
                }
                else
                {
                    Console.WriteLine("testcase passed");
                    Console.ReadLine();
                }
            }
        }
    }
}

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list