Home All Groups Group Topic Archive Search About

.NET 1.1 and 2.0 interface binary compatibility

Author
19 Nov 2007 9:23 AM
hatch
Hi,

i have an issue with .NET 2.0 compiler, that generates different
interface assemblies than .NET 1.1 compiler. And this causes
applications (compiled against 1.1 interfaces) to throw
System.MissingMethodException. Recompiling application (no changes
made) with 2.0 interfaces solves the problem. - But this still breaks
binary compatibility, which should be maintained considering
interfaces themselves were not changed.


Ildasm output of interfaces compiled with .NET 1.1

..property instance valuetype
Marg.Planet.Interfaces.Portlet.WindowState
        WindowState()
{
  .get instance valuetype Marg.Planet.Interfaces.Portlet.WindowState
Marg.Planet.Interfaces.Portlet.IPortletRequest::get_WindowState()
} // end of property IPortletRequest::WindowState


Ildasm output of interfaces compiled with  .NET 2.0

..method public hidebysig newslot specialname abstract virtual
        instance valuetype
[Marg.Planet.Interfaces]Marg.Planet.Interfaces.Portlet.WindowState
        get_WindowState() cil managed
{
} // end of method IPortletRequest::get_WindowState


The difference is in get_WindowState() method's signature...

Note that Marg.Planet.Interfaces.Portlet.WindowState
is enum in Marg.Planet.Interfaces.dll assembly
public enum WindowState { ... }

And is getter (with same name)
in Marg.Planet.Interfaces.Portlet.dll assembly
WindowState WindowState { get; }


I realize this was a bad coding practice to begin with, but is there
any solution to make it binary compatible?

Author
22 Nov 2007 11:47 AM
Alexander Vasilevsky
Most likely only at the IL level

http://www.alvas.net  - Audio tools for C# and VB.Net developers


Show quote
"hatch" <hatche***@gmail.com> ???????/???????? ? ???????? ?????????:
news:30d89464-ab9d-4d4f-b401-1fad56e142c8@c29g2000hsa.googlegroups.com...
> Hi,
>
> i have an issue with .NET 2.0 compiler, that generates different
> interface assemblies than .NET 1.1 compiler. And this causes
> applications (compiled against 1.1 interfaces) to throw
> System.MissingMethodException. Recompiling application (no changes
> made) with 2.0 interfaces solves the problem. - But this still breaks
> binary compatibility, which should be maintained considering
> interfaces themselves were not changed.
>
>
> Ildasm output of interfaces compiled with .NET 1.1
>
> .property instance valuetype
> Marg.Planet.Interfaces.Portlet.WindowState
>        WindowState()
> {
>  .get instance valuetype Marg.Planet.Interfaces.Portlet.WindowState
> Marg.Planet.Interfaces.Portlet.IPortletRequest::get_WindowState()
> } // end of property IPortletRequest::WindowState
>
>
> Ildasm output of interfaces compiled with  .NET 2.0
>
> .method public hidebysig newslot specialname abstract virtual
>        instance valuetype
> [Marg.Planet.Interfaces]Marg.Planet.Interfaces.Portlet.WindowState
>        get_WindowState() cil managed
> {
> } // end of method IPortletRequest::get_WindowState
>
>
> The difference is in get_WindowState() method's signature...
>
> Note that Marg.Planet.Interfaces.Portlet.WindowState
> is enum in Marg.Planet.Interfaces.dll assembly
> public enum WindowState { ... }
>
> And is getter (with same name)
> in Marg.Planet.Interfaces.Portlet.dll assembly
> WindowState WindowState { get; }
>
>
> I realize this was a bad coding practice to begin with, but is there
> any solution to make it binary compatible?

AddThis Social Bookmark Button