473,765 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

binary compatibility support for .NET assembly

Suppose that I have a class in an assembly that is delivered to the user,
what can I do to change the class so that it doesn't break the
binary compatibility? That is, user application can run with recompiling
and relinking.

I know that if I define an interface, and only expose the interface but not
the class which implments the interface, I can add a data member to the
class without breaking the binary compatibility. If the class itself,
rather than the interface is exposed to user, can I still add a data member
to the class without breaking the binary compatibility? What are other
restrictions that won't break the binary compatibility?

In pure C++, adding a data member to a class that is exposed to the user
will break compatibility.

Thanks.
Nov 22 '05 #1
6 3283
Suppose that I have a class in an assembly that is delivered to the user,
what can I do to change the class so that it doesn't break the
binary compatibility? That is, user application can run with recompiling
and relinking.


A mistake: 'with' should be 'without'.
Nov 22 '05 #2
hi
when you are speaking about com and binary
compatibility.A dding an interface only generates a new iid
and does not break the binary compatibility as new version
can use the new features(class with new iid included)
where as the older version still works with their older
version.The compatibility breaks only when you changes the
signatures or remove some interfaces etc.
But with .Net you need not to depend on registry .The only
thing you remember is how are you handling the versioning
and whether you are using private or shared
assemblies.Ther efore you need not have to be worried about
binary compatibility at all because in .net multiple
version can run side by side and even you can specify
which client or application will use which version of the
components.
hope that this helps
shreeman
sn*********@red iffmail.com

-----Original Message-----
Suppose that I have a class in an assembly that is delivered to the user,what can I do to change the class so that it doesn't break thebinary compatibility? That is, user application can run with recompilingand relinking.

I know that if I define an interface, and only expose the interface but notthe class which implments the interface, I can add a data member to theclass without breaking the binary compatibility. If the class itself,rather than the interface is exposed to user, can I still add a data memberto the class without breaking the binary compatibility? What are otherrestrictions that won't break the binary compatibility?

In pure C++, adding a data member to a class that is exposed to the userwill break compatibility.

Thanks.
.

Nov 22 '05 #3
"someone" <so****@somewhe re.com> wrote in
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Suppose that I have a class in an assembly that is delivered to the user,
what can I do to change the class so that it doesn't break the
binary compatibility? That is, user application can run with recompiling
and relinking.
..net applications are just-in-time compiled; There is no "linker". The kind
of tasks that used to be done by the linker are done at runtime (by the JIT)
anyway.
I know that if I define an interface, and only expose the interface but not the class which implments the interface, I can add a data member to the
class without breaking the binary compatibility. If the class itself,
rather than the interface is exposed to user, can I still add a data member to the class without breaking the binary compatibility?
Yes.
What are other restrictions that won't break the binary compatibility?
Don't remove methods, make them private or change their signature if they
are used by the client. You'll get a "MissingMethodE xception" if the JIT
can't find a method that's called in your code.
In pure C++, adding a data member to a class that is exposed to the user
will break compatibility.


Yep. There are ways around this, but they usually require some work.
That's one of the reasons why .net was invented.

Niki
Nov 22 '05 #4
"Niki Estner" <ni*********@cu be.net> wrote in
news:ez******** ********@TK2MSF TNGP11.phx.gbl. ..
"someone" <so****@somewhe re.com> wrote in
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Suppose that I have a class in an assembly that is delivered to the user, what can I do to change the class so that it doesn't break the
binary compatibility? That is, user application can run with recompiling and relinking.
.net applications are just-in-time compiled; There is no "linker". The

kind of tasks that used to be done by the linker are done at runtime (by the JIT) anyway.


Sorry, that wasn't 100% correct: There is a linker (al.exe) that fuses
modules and resources, but it is rarely used, at least not in a usual
VS-build cycle.

Niki
Nov 22 '05 #5
What about enumeration constants defined? if their value is changed, I
assume that the binary compatibility is broken. I know that this is true in
C++.

"Niki Estner" <ni*********@cu be.net> wrote in message
news:ez******** ********@TK2MSF TNGP11.phx.gbl. ..
"someone" <so****@somewhe re.com> wrote in
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Suppose that I have a class in an assembly that is delivered to the user, what can I do to change the class so that it doesn't break the
binary compatibility? That is, user application can run with recompiling and relinking.
.net applications are just-in-time compiled; There is no "linker". The

kind of tasks that used to be done by the linker are done at runtime (by the JIT) anyway.
I know that if I define an interface, and only expose the interface but

not
the class which implments the interface, I can add a data member to the
class without breaking the binary compatibility. If the class itself,
rather than the interface is exposed to user, can I still add a data

member
to the class without breaking the binary compatibility?


Yes.
What are other restrictions that won't break the binary compatibility?


Don't remove methods, make them private or change their signature if they
are used by the client. You'll get a "MissingMethodE xception" if the JIT
can't find a method that's called in your code.
In pure C++, adding a data member to a class that is exposed to the user
will break compatibility.


Yep. There are ways around this, but they usually require some work.
That's one of the reasons why .net was invented.

Niki

Nov 22 '05 #6
I'm sorry, my first reply was definitely too short; Unfortunately I didn't
find any good article on the subject; So, here's a short list of things I
that came to my mind right now; In general
- You may safely change default values of data members
- You may safely change all private/internal fields of a class/struct
- You may usually add properties or methods to an existing class or struct
(this only hurts the client if it derives a class from that class, and
happens to add a property/method with the same signature)
- You may usually add data members and events to a class or struct, unless
you use binary serialization in your clients (the binary layout changes with
new data members)
- Removing, renaming or changing the type/signature of public/protected
properties/data members/events/methods can cause clients to crash (however
unlike C++ you'll get something like a "MethodNotFound Exception", and no
memory will be overwritten) if (and only if) the client uses that member
- Removing an interface or changing the base class may hurt clients, if the
client casts to that class/interface
- Changing static constants/enums causes clients to break (didn't think of
that before your post)

Of course this list isn't complete, and there are may still be some cases
where even these rules don't work (e.g. if the client tries to invoke a
non-existing method using late-binding; If you add that method, the client
will behave differently). But I hope that this at least gives you a rough
sketch of what is done at compile-time, and what is done at run-time.

In general, if you expect an assembly to change often, using interfaces for
communication is not a bad idea.

Niki

"someone" <so****@somewhe re.com> wrote in
news:er******** ******@TK2MSFTN GP10.phx.gbl...
What about enumeration constants defined? if their value is changed, I
assume that the binary compatibility is broken. I know that this is true in C++.

"Niki Estner" <ni*********@cu be.net> wrote in message
news:ez******** ********@TK2MSF TNGP11.phx.gbl. ..
"someone" <so****@somewhe re.com> wrote in
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Suppose that I have a class in an assembly that is delivered to the user, what can I do to change the class so that it doesn't break the
binary compatibility? That is, user application can run with recompiling and relinking.


.net applications are just-in-time compiled; There is no "linker". The

kind
of tasks that used to be done by the linker are done at runtime (by the

JIT)
anyway.
I know that if I define an interface, and only expose the interface but
not
the class which implments the interface, I can add a data member to
the class without breaking the binary compatibility. If the class itself,
rather than the interface is exposed to user, can I still add a data

member
to the class without breaking the binary compatibility?


Yes.
What are other restrictions that won't break the binary compatibility?


Don't remove methods, make them private or change their signature if

they are used by the client. You'll get a "MissingMethodE xception" if the JIT
can't find a method that's called in your code.
In pure C++, adding a data member to a class that is exposed to the user will break compatibility.


Yep. There are ways around this, but they usually require some work.
That's one of the reasons why .net was invented.

Niki


Nov 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
481
by: someone | last post by:
Suppose that I have a class in an assembly that is delivered to the user, what can I do to change the class so that it doesn't break the binary compatibility? That is, user application can run with recompiling and relinking. I know that if I define an interface, and only expose the interface but not the class which implments the interface, I can add a data member to the class without breaking the binary compatibility. If the class...
103
48747
by: Steven T. Hatton | last post by:
§27.4.2.1.4 Type ios_base::openmode Says this about the std::ios::binary openmode flag: *binary*: perform input and output in binary mode (as opposed to text mode) And that is basically _all_ it says about it. What the heck does the binary flag mean? -- If our hypothesis is about anything and not about some one or more particular things, then our deductions constitute mathematics. Thus mathematics may be defined as the subject in...
3
2223
by: pontifikas | last post by:
I've created some code, manipulating an Excel application. Unfortunately this does not work on systems with Other Office distros than Office XP. Is there something I can do to ensure compatibility?Some header or Define There was an example in MSDN web Doc, but those guys in M$ seem to have a very good relationship with entropia.... :evil:
3
3046
by: Michi Henning | last post by:
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
14
2323
by: frostalicious | last post by:
Used VB.NET (on my client PC) to convert VB6 executable to .NET executable. Placed the .exe file on a network drive on my server. From client, ran .NET Wizards "Trust an Assembly" to make the .exe (on the network drive, on the server) "Full Trust." From the client, double-click on the ..exe (on the network drive, on the server) and it runs fine. So far, so good, but... On the server, where I've installed not VB.NET but .NET
2
2998
by: DaveP | last post by:
In Visual Basic 6.0, there was a setting for DLL's that would prevent a developer from breaking binary compatibility of a DLL by changing a function name, parameters, etc. Warnings would appear at compile time. Is there any such thing in .NET? I can't seem to find the same type of setting, but I do want a way to prevent developers from changing signatures of functions. Thanks, Dave P.
68
5256
by: vim | last post by:
hello everybody Plz tell the differance between binary file and ascii file............... Thanks in advance vim
4
1894
by: zak | last post by:
we have a suite of products that have a number of shared assemblies. During development and support the shared assemblies code will change . I want to control the versioning, so if the code chnages are binary compatable ( i.e interfaces have not changed) then we can retain the same version number for the assembly and just change the hot fix number in the assembly. But how do I know that binary compatability has been maintained to...
1
1601
by: Simon Woods | last post by:
Hi I have a dll ('dll-X') which runs on top of (dependent upon) several other dlls. My build environment has a folder structure binaries compat-libs
17
2959
by: osama178 | last post by:
Hi, What does it mean for an object to be binary compatible? And why aren't STL objects binary compatible? Any insights, links, resources for further reading are greatly appreciated. Thanks.
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.