[Mono-devel-list] Assembly binary compatibility?

Michi Henning michi at zeroc.com
Tue May 3 19:25:01 EDT 2005


Hi,

I'm interested in figuring out exactly what kind of change to an assembly
is binary compatible. I've browsed the doc a fair bit, but I can't find a
comprehensive list of what actually constitutes binary compatibility.
Could someone point me at an authoritative list?

One question in particular I am interested in. Consider an object such as this:

class SomeClass
{
     // ...
     public void destroy()
     {
         lock(this)
         {
             // Clean up some things here...
             _destroyed = true;
         }
     }

#if DEBUG
     ~SomeClass()
     {
         if(!System.Environment.HasShutdownStarted)
         {
             lock(this)
             {
                  if(!_destroyed)
                  {
                       System.Console.Error.WriteLine("SomeClass wasn't
destroyed!");
                  }
             }
         }
     }
#endif

     private bool _destroyed = false;
}

Note that the destructor simply checks whether destroy() was called before the
instance is collected and that this is required only for a debug build. In
order to save the cost of acquiring the lock (and to avoid the cost of calling the
destructor altogether), the entire destructor is made conditional.

Suppose I build the assembly without DEBUG defined and install it in the GAC.
I also compile a program that uses the assembly, but both the program and the
assembly are compiled *with* DEBUG defined. If I then later take the program
(but not the assembly) and run the program compiled *with* DEBUG against
the assembly compiled *without* DEBUG, will the program still work?

Cheers,

Michi.

-- 
Michi Henning              Ph: +61 4 1118-2700
ZeroC, Inc.                http://www.zeroc.com





More information about the Mono-devel-list mailing list