Gary Jones
Gary Jones

Reputation: 3197

Error when trying to create .NET object from VB6

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?

Upvotes: 1

Views: 492

Answers (1)

Jeff
Jeff

Reputation: 36583

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.

Upvotes: 1

Related Questions