What violates the .net binary (dll) interface

Consider two .net dlls. Firstly, "application.dll" contains the core business logic and data access code. Secondly, "webservice.dll" consists mainly of WebMethods that reference objects and methods using application.dll to provide web service calls to existing code.

What changes (eg, adding new classes, adding a new field or method to an existing class, etc.) can and cannot be made to application.dll without having to recompile webservice.dll?

+4
source share
3 answers

Most things will be fine; some things that will break it:

  • Removing * types that are used (unless you use type redirection)
  • Removing * methods that are used (including constructor)
  • Change the signature of methods (which are used)
  • Change public fields to properties (which are used)
  • Change serialization interval if serialization is used
  • Adding a method to an interface, where the second dll has a type that implements this interface
  • Adding an abstract method to the base class, which is inherited in the second dll
  • Almost everything internal if hacker reflection is used (ab)
  • Adding Constraints to a Generic Type / Method
  • Sealed type sealed when it was inherited in the second dll
  • Adding a field to a struct if the caller uses default initialization rather than constructor initialization

(deletion involves changing the availability for something non-public)

+3
source

Technically, the name will split it (name and version and key token in case of strong named assemblies). Otherwise, the structure will try to load and use the DLL, and this will work more or less finely until it reaches another signature of the type or method, the missing type, etc. But keep in mind that name reuse happens directly to a DLL hell (or problem).

I suggest learning more about the build version to get an idea of ​​how to solve such problems.

+1
source

you can make any changes to application.dll without requiring recompilation of webservice.dll, if you do not call new classes, functions [added to application.dll]. if you want to use any of your application.dll changes to webservice.dll, you need to recompile webservice.dll

if you change the signature or access level of any of the methods or properties in application.dll that are used by websrvice.dll, this will violate your code in webservice.

0
source

All Articles