473,785 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interface re-implementation changed from 1.0 to 2.0???

Something has changed from C# 1.0 to 2.0 regarding interface
re-implementation. See my sample code below; when compiled and run under VS
2003, you get:

Control.Paint
Control.IContro l.Paint

But when compiled and run under VS 2005: you get:

Control.Paint
Control.Paint

Please explain why in C# 2.0, a class that re-implements an interface
prefers to map to a virtual method of the base class rather than an explicit
implementation of the base class.

Thanks
----
using System;

namespace InterfaceMapTes t
{
class MyApp
{
static void Main(string[] args)
{
MyControl obj = new MyControl();
obj.Paint();

IControl iControl = obj as IControl;
iControl.Paint( );
}
}

public interface IControl
{
void Paint();
}

class Control : IControl
{
public virtual void Paint()
{
Console.WriteLi ne("Control.Pai nt");
}

void IControl.Paint( )
{
Console.WriteLi ne("Control.ICo ntrol.Paint");
}
}

class MyControl : Control, IControl
{
}
}
Aug 31 '06
20 1616
Greg Young wrote:
More information
http://codebetter.com/blogs/gregyoun...0-runtime.aspx

I believe it is a bug but has been fixed in revision 97.
and where exactly does 50727.97 come from?

I see it mentioned in at least one KB, but I don't see any indication that
it's generally available, other than as part of a hotfix.

-cd
Sep 2 '06 #11
Thats the only place I can find it as well although I believe it is also
installed with one of the betas currently out as one of my machines here has
it. I have pushed out a mention that an update may be needed in order to
actually solve this in a "good" way.

Cheers,

Greg
"Carl Daniel [VC++ MVP]" <cp************ *************** **@mvps.org.nos pam>
wrote in message news:ey******** *****@TK2MSFTNG P03.phx.gbl...
Greg Young wrote:
>More information
http://codebetter.com/blogs/gregyoun...0-runtime.aspx

I believe it is a bug but has been fixed in revision 97.

and where exactly does 50727.97 come from?

I see it mentioned in at least one KB, but I don't see any indication that
it's generally available, other than as part of a hotfix.

-cd


Sep 2 '06 #12
Thanks for your investigation Greg and Jeffrey. It's VERY interesting to see
that it behaves "the old way" with 50727.97. The July CTP of Vista includes
that runtime. Jeffrey, we have a large C# application that depends on the
correct way of interface mapping, and I'm very uneasy about simply attempting
to find all the places where I would need to change code to make it work with
2.0.50727.42. Please let me know if Microsoft will be making some sort of
public fix or if I need to create a case with PSS.

Thanks!

"Greg Young" wrote:
Thats the only place I can find it as well although I believe it is also
installed with one of the betas currently out as one of my machines here has
it. I have pushed out a mention that an update may be needed in order to
actually solve this in a "good" way.

Cheers,

Greg
"Carl Daniel [VC++ MVP]" <cp************ *************** **@mvps.org.nos pam>
wrote in message news:ey******** *****@TK2MSFTNG P03.phx.gbl...
Greg Young wrote:
More information
http://codebetter.com/blogs/gregyoun...0-runtime.aspx

I believe it is a bug but has been fixed in revision 97.
and where exactly does 50727.97 come from?

I see it mentioned in at least one KB, but I don't see any indication that
it's generally available, other than as part of a hotfix.

-cd


Sep 3 '06 #13
Andy DeMaurice wrote:
Thanks for your investigation Greg and Jeffrey. It's VERY
interesting to see
that it behaves "the old way" with 50727.97. The July CTP of Vista
includes
that runtime. Jeffrey, we have a large C# application that depends
on the
correct way of interface mapping, and I'm very uneasy about simply
attempting
to find all the places where I would need to change code to make it
work with
2.0.50727.42. Please let me know if Microsoft will be making some
sort of
public fix or if I need to create a case with PSS.
You might try requesting the hotfix for KB917782, which appears to include
50727.97 of mscorlib.dll, which is presumably where the fix appears. That
may not be a good solution, but it might be a workable one.

http://support.microsoft.com/kb/917782

-cd
Sep 3 '06 #14
Hi Andredem,

Yes, based on the feedback, one C# developer is forwarding my email to
another 3 experts on this topic now, but I still did not get any update
from them.

Anyway, I have just sent another strike email to them, and asked for the
confirmation of whether 2.0.50727.97 version of CLR will fix this problem.
Once, I got the confirmation, which means that this hotfix is the correct
solution, you may just contact Microsoft PSS and request for the hotfix of
KB917782.

I will update any information here ASAP. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 4 '06 #15
Jeffrey,

There has been some other discussion on this ..

While requesting the hotfix will work great for server hosted applications
it would seem to me that there will need to be an update sent out for client
based products where you cannot control the version of the runtime. I guess
one could use the tactic of installing the hotfix with their application but
this seems rather innapropriate and open to numerous other problems
(especially with smart client applications).

Cheers,

Greg
""Jeffrey Tan[MSFT]"" <je***@online.m icrosoft.comwro te in message
news:lk******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi Andredem,

Yes, based on the feedback, one C# developer is forwarding my email to
another 3 experts on this topic now, but I still did not get any update
from them.

Anyway, I have just sent another strike email to them, and asked for the
confirmation of whether 2.0.50727.97 version of CLR will fix this problem.
Once, I got the confirmation, which means that this hotfix is the correct
solution, you may just contact Microsoft PSS and request for the hotfix of
KB917782.

I will update any information here ASAP. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no
rights.

Sep 4 '06 #16
Greg Young <dr************ *******@hotmail .comwrote:
There has been some other discussion on this ..

While requesting the hotfix will work great for server hosted applications
it would seem to me that there will need to be an update sent out for client
based products where you cannot control the version of the runtime. I guess
one could use the tactic of installing the hotfix with their application but
this seems rather innapropriate and open to numerous other problems
(especially with smart client applications).
It certainly seems like a pretty horrible bug :(

Just to remind people who may be worried about this - it's easy to work
out which version you're using - Environment.Ver sion gives you all the
necessary bits.

Still shuddering at this kind of thing making it out of the door
though...

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Sep 5 '06 #17

Jon wrote:
Still shuddering at this kind of thing making it out of the door
though...
Yeah, that's one of the higher profile ones I've seen in awhile.

Sep 6 '06 #18
Hi Andredem,

Sorry for the late response. I was out of office yesterday.

Yes, our C# team has confirmed this as a bug of CLR2.0, however, I still
did not get the confirmation of whether KB917782 will have any side-effect.

Currently, I recommend you contact Microsoft PSS for a case support to
obtain a hotfix. Since this issue is confirmed as a bug, this support
incident will be free. I think this is the most efficient way to resolve
your problem.

You can contact Microsoft Product Support by contacting us at
1-(800)936-5800 or by choosing one of the options listed at:
http://www.microsoft.com/services/mi...v_support.mspx.

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 7 '06 #19
Ok some follow up on this ..

it appears that the hot fix does not fix the problem ... I tested with
2.0.50727.97 in vista which worked. The 2.0.50727.97 version of that hotfix
I am told does not work. This would make the problem that much more
difficult as you can now not even check for an environment version to see if
the system youa re running against has the issue or not.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Brian Gideon" <br*********@ya hoo.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
>
Jon wrote:
>Still shuddering at this kind of thing making it out of the door
though...

Yeah, that's one of the higher profile ones I've seen in awhile.

Sep 8 '06 #20

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

Similar topics

4
8205
by: Roy Pereira | last post by:
I have an application that is composed of a set of "Content" dlls and a viewer application. The viewer calls a standard set of functions that are present in all the dlls. I maintain this by making my contnent dlls implement an interface created in vb6. The viewer application is bound to this interface. This way, I am able to add Content without redeploying the dlls (I just have to add the new dlls). I want to write new content for...
3
3371
by: Davide M3xican Coppola | last post by:
Hi, I would realize an interface (interface) for a pair of concrete classes (concrete & concrete2), but I have a problem because I have to access to a third class (element) and if I try to declare interface class as friend, I obtain this (right) error: main2.cpp: In member function `virtual void concrete::method(element&)': main2.cpp:8: error: `int element::a_int' is protected main2.cpp:31: error: within this context
1
8514
by: Microsoft | last post by:
Hello there, I have following situation , how can I solve this puzzle in C#. I have interface called IVendor with some custom attributes applied to it interface IVendor {
6
5199
by: Donal McWeeney | last post by:
I was under the impression that in an interface declaration I could inherit another interface declaration and the result would be that the inheriting interface could include the methods and properties defined in the inherited interface. However when playing with this and defining a class to implement the interface the class gets implemented with both sets of interface declarations. eg.
4
2109
by: christopher diggins | last post by:
A feature that I find signficantly missing in C# is the ability to write functions in interfaces that can call other functions of the interface. Given an interface ISomeInteface the only way we can write a general purpose function to operate on all objects which implement that interface is through the following style of declaration (in the following code snippets i is an interface variable of type ISomeInterface) : SomeStaticClass {...
3
4143
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability. The User Experience, or how the user experiences the end product, is the key to acceptance. And that is where User Interface Design enters the design process. While product engineers focus on the technology, usability specialists focus on the user...
6
12001
by: Sgt. Sausage | last post by:
I know it's not possible, but I need a protected internal interface: protected internal interface ISomeInterface{ // yadda yadda yadda } Basically, I need an interface that is completely accessable from within the assembly (internal), but is not valid outside
2
4990
by: Alex Sedow | last post by:
Why interface-event-declaration does not support multiple declarators like event-declaration? Grammar from C# spec: variable-declarators: variable-declarator variable-declarators "," variable-declarator variable-declarator:
0
1075
by: Scott James | last post by:
This seems like a strange one, but perhaps someone can shed some light. I have an interface: ItciEngine implemented by class tciEngine. Two public methods in this class pass an object I've created: uiMessage: Public Function TesterInteract(ByVal luiMessage As IuiMessage) As IuiMessage Implements ItciEngine.TesterInteract
0
988
by: Eric | last post by:
I'm trying to create a single interafce that can be implelment by either a ..Net class or a COM object. Here's what I'm tried to do. I defined an interface using VB.net in an assembly all by itself. This interface has a couple of simple procedures and 3 events. I created a test project in VB.Net to test a class implementing the interface and everything works fine. I'm now trying to get a COM object to implement this interface. I used...
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10350
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
10157
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
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
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
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
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
3
2887
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.