C++/CLI Article : Deriving from a C# disposable class

Last week at work, I had to work on a C++/CLI class that derived from a class written in C# which implemented IDisposable. I got it wrong at first (yeah, same guy who wrote a book on the subject a couple of years ago) and my boss and I spent some time going through the generated code in Reflector before fixing it up. I came home that night and quickly put together a simple project so I could see the whole picture from a simple perspective. I thought it would benefit others to put together an article reflecting (no pun intended) the issue.


2 thoughts on “C++/CLI Article : Deriving from a C# disposable class

  1. This is slightly off topic, but we have a C++/CLI assembly (built on tons of portable C code) that we are having trouble with when VB users reference it. It’s like we are exporting everything, every name, every symbol, etc. Then the VB clients clash with error BC30389: ‘encoding’ is not accessible in this context because it is ‘Friend’.

    (we have an ‘encoding’ structure defined, as well as a #define)

    If they fully quality ‘Encoding’ as ‘System.Text.Encoding’, all is well.

    Our C# users don’t have this problem. Only the VB client apps.

    Any thoughts?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s