none
[VB.NET 2005] Attempted to read or write protected memory. This is often an indication that other memory is corrupt RRS feed

  • Question

  • Good morning!

    I've developed a windows service using VB.NET 2005. The service, sometimes, catch the error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" when it try to convert a file from the "TIF" format to the "AFP" format.

    This doesn't happen alway but i can't understand what causes it and what are the condition why happens.

    Have you ever found the same error?

    Thank you in advance! Good work! 

    Alessandro

    Tuesday, November 9, 2010 11:59 AM

Answers

  • > "TIF" format to the "AFP" format.

    This is most likely due to incorrect usage of native code (P/Invoke or COM).  It's really easy to get these things slightly wrong, including in ways that show up somewhat randomly.  Facts of life in C/C++, managed code shields you from them.

    If your usage is correct, then this might be a bug in the code you are calling.

    > Have you ever found the same error?

    Common when using native code.  That message itself does not provide much insight.  If you are using P/Invoke, please post the P/Invoke declarations along with a link documentation on which you based these declarations. (The Declare statements or the DllImport lines.)

     

    • Marked as answer by SamAgain Friday, November 19, 2010 5:00 AM
    Wednesday, November 10, 2010 1:20 AM