Author Topic: .NET MDA being invoked  (Read 3006 times)

0 Members and 1 Guest are viewing this topic.

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
.NET MDA being invoked
« on: June 24, 2008, 03:25:05 am »
Code:
Code: [Select]
        protected virtual void OnConnected(EventArgs e)
        {
            foreach (EventHandler eh in __Connected[Priority.High])
            {
                try
                {
                    eh(this, e);
                }
                catch (Exception ex)
                {
                    ReportException(
                        ex,
                        new KeyValuePair<string, object>("delegate", eh),
                        new KeyValuePair<string, object>("Event", "Connected"),
                        new KeyValuePair<string, object>("param: priority", Priority.High),
                        new KeyValuePair<string, object>("param: this", this),
                        new KeyValuePair<string, object>("param: e", e)
                        );
                }
            }

            ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            {
                foreach (EventHandler eh in __Connected[Priority.Normal])
                {
                    try
                    {
                        eh(this, e);
                    }
                    catch (Exception ex)
                    {
                        ReportException(
                            ex,
                            new KeyValuePair<string, object>("delegate", eh),
                            new KeyValuePair<string, object>("Event", "Connected"),
                            new KeyValuePair<string, object>("param: priority", Priority.Normal),
                            new KeyValuePair<string, object>("param: this", this),
                            new KeyValuePair<string, object>("param: e", e)
                            );
                    }
                }
                ThreadPool.QueueUserWorkItem((WaitCallback)delegate
                {
                    foreach (EventHandler eh in __Connected[Priority.Low])
                    {
                        try
                        {
                            eh(this, e);
                        }
                        catch (Exception ex)
                        {
                            ReportException(
                                ex,
                                new KeyValuePair<string, object>("delegate", eh),
                                new KeyValuePair<string, object>("Event", "Connected"),
                                new KeyValuePair<string, object>("param: priority", Priority.Low),
                                new KeyValuePair<string, object>("param: this", this),
                                new KeyValuePair<string, object>("param: e", e)
                                );
                        }
                    }
                    FreeArgumentResources(e as BaseEventArgs);
                });
            });
        }

FatalExecutionEngineError Managed Debugging Assistant comes up with:
Quote
The runtime has encountered a fatal error. The address of the error was at 0x7f578493, on thread 0x14ec. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
(Note 0xc0000005 is ACCESS_VIOLATION).

I doubt I'll get much help but, thoughts?

Also, yes, if I take out the anonymous delegate calls and make those calls inline without a separate thread, the error goes away.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Lead

  • x86
  • Hero Member
  • *****
  • Posts: 635
  • Shaman of Sexy.
    • View Profile
Re: .NET MDA being invoked
« Reply #1 on: July 09, 2008, 05:43:33 pm »
Code:
Code: [Select]
        protected virtual void OnConnected(EventArgs e)
        {
            foreach (EventHandler eh in __Connected[Priority.High])
            {
                try
                {
                    eh(this, e);
                }
                catch (Exception ex)
                {
                    ReportException(
                        ex,
                        new KeyValuePair<string, object>("delegate", eh),
                        new KeyValuePair<string, object>("Event", "Connected"),
                        new KeyValuePair<string, object>("param: priority", Priority.High),
                        new KeyValuePair<string, object>("param: this", this),
                        new KeyValuePair<string, object>("param: e", e)
                        );
                }
            }

            ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            {
                foreach (EventHandler eh in __Connected[Priority.Normal])
                {
                    try
                    {
                        eh(this, e);
                    }
                    catch (Exception ex)
                    {
                        ReportException(
                            ex,
                            new KeyValuePair<string, object>("delegate", eh),
                            new KeyValuePair<string, object>("Event", "Connected"),
                            new KeyValuePair<string, object>("param: priority", Priority.Normal),
                            new KeyValuePair<string, object>("param: this", this),
                            new KeyValuePair<string, object>("param: e", e)
                            );
                    }
                }
                ThreadPool.QueueUserWorkItem((WaitCallback)delegate
                {
                    foreach (EventHandler eh in __Connected[Priority.Low])
                    {
                        try
                        {
                            eh(this, e);
                        }
                        catch (Exception ex)
                        {
                            ReportException(
                                ex,
                                new KeyValuePair<string, object>("delegate", eh),
                                new KeyValuePair<string, object>("Event", "Connected"),
                                new KeyValuePair<string, object>("param: priority", Priority.Low),
                                new KeyValuePair<string, object>("param: this", this),
                                new KeyValuePair<string, object>("param: e", e)
                                );
                        }
                    }
                    FreeArgumentResources(e as BaseEventArgs);
                });
            });
        }

FatalExecutionEngineError Managed Debugging Assistant comes up with:
Quote
The runtime has encountered a fatal error. The address of the error was at 0x7f578493, on thread 0x14ec. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
(Note 0xc0000005 is ACCESS_VIOLATION).

I doubt I'll get much help but, thoughts?

Also, yes, if I take out the anonymous delegate calls and make those calls inline without a separate thread, the error goes away.

Q: What version of the framework are you compiling on?


Quote
Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. - Homer Simpson

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: .NET MDA being invoked
« Reply #2 on: July 10, 2008, 03:30:15 am »
I'm compiling to 2.0.

I actually fixed the issue - it was a very, very weird parameter binding issue dealing with using a params[] parameter list instead of a defined parameter list.  Funkified.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.