Windows 2000 System.AccessViolationException

I have an app that happily loads a dll, and then uses

something as IntPtr = GetProcAddress
...delegate ... = System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(...

and then obsessively calls the function that was just loaded.

Now, in Windows XP, on lots of different computers, my app runs perfectly well. But then on Windows 2000 after a few thousand calls to the function I get an error like this:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at MyApp.MyClass.MyDelegate.Invoke(...

Ideas



Answer this question

Windows 2000 System.AccessViolationException

  • ycseattle

    Maybe the dll was unloaded
  • sunny123

    No...but then I started getting a bunch of errors on XP when my remote class would raise an event, and then I had to Invoke the main window to update error status - the Invoke call would freeze everything. I got rid of the event and this "solved" my problem; oh well, I was getting too deep into spaghetti code anyway.
  • Windows 2000 System.AccessViolationException