1

I am suddenly getting the following error when trying to create a .NET object from VB6 code. It has been working up until now.

Error: -2147467261: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

What is the cause?

5
  • FWIW, the error code here is E_POINTER, which usually means that an invalid (or NULL) reference was used for an out parameter to a call. Did you change either the .NET code or the VB code? Commented Feb 20, 2012 at 3:44
  • No changes I'm aware of. Of course I will have to check, but I would like to know what the actual problem is. Commented Feb 20, 2012 at 3:58
  • This seems like the sort of issue that you'll have to get under a debugger to learn more. Depending on where the issue is, you may need to debug one or both sides of the interop--in VB6 and/or .NET. Commented Feb 20, 2012 at 4:01
  • Could you show some of the code, on both sides? Commented Feb 20, 2012 at 6:20
  • The error is E_POINTER but the message is an AccessViolation. Pretty standard failure mode for DLL Hell. Rebuild the .NET component, recreate the type library, re-register and update the VB6 reference. Commented Feb 26, 2012 at 20:15

1 Answer 1

1

Has your .NET COM interface changed? If so, you will need to re-regasm your .NET dll in order to update the COM registry accordingly.

Also, if you update the version of the .NET dll with new builds, you'll want to make sure you don't have conflicting versions registered. Try searching the registry for the name of your dll and deleting any keys under HKCR. Then try re-regasm'ing your .NET dll.

Finally, I've seen this error when a constructor (or static constructor) in .NET throws an exception during the creation of your .NET object. Add some tracing and error handling to make sure this isn't the case.

Sign up to request clarification or add additional context in comments.

1 Comment

Also make sure that other .NET dlls int he same process havent loaded (their own local) older copies causing even more hell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.