Suppose we have the class X
in version 1 of the assembly A.dll
:
class X {
SomeType Property { set; get; }
}
and then in version 2 of the assembly A.dll
:
class X {
SomeType Property { set; get; }
SomeType OtherProperty { set; get; }
}
Now suppose we have a second assembly B.dll
that loads A.dll
and uses X. Will the addition of the property OtherProperty
break the ABI? Will B.dll
fail to use A.dll
/X
? If not, would the order of the declarations make any difference? If the properties had been virtual, had it made any difference?
I guess I'm really asking: what are the general ABI rules? I know changing interfaces after they have been published is a bad thing, but I really would like to be able to add properties in some instances, without adding subclasses.
Adding properties should be fine.
One case that will break is if you for example add something to the middle of an automatically numbered enum. For example if you have this code in your library:
enum Foo
{
Bar,
Qux
}
and you change it to this:
enum Foo
{
Bar,
Baz,
Qux
}
Then you will also need to recompile any code like this:
if (foo == Foo.Qux)
{
// ...
}