Click Here to Install Silverlight*
IndiaChange|All Microsoft Sites
MSDN
|Developer Centers|Library|Downloads|How To Buy|Subscribers|My MSDN
 
Chat Transcript
 
COM - .NET Interoperability
Host
: Yan-Hong Huang & Allen Weng - Sr. Support Engineers, MS Global Technical Engg. Center - Shanghai, China
March 7, 2002
 
KunalS[MS]: Welcome everybody

KunalS[MS]: The topic of today's chat is

KunalS[MS]: .NET - COM Interoperability

KunalS[MS]: and the experts on today's chat are

Manish: hello Mr.Yan-Hong

KunalS[MS]: Yanhong and Allen

yhhuang[MS]: Hello

KunalS[MS]: from MS GTEC, Shanghai

Allen[MS]: Nice to meet u

KunalS[MS]: So please go ahead

rami: Hi all nice meeting

Manish: hello Allen

KunalS[MS]: and share all your doubts and queries

rami: sure

Allen[MS]: any question is welcome.

rami: In dotnet do we really need COM components?

yhhuang[MS]: sure

Deepak: hi, quick question: how is COM Interop in terms of performance

Manish: Well for accessing com components in .NET we have RCW, still we see createobject is supported in VB.NET, so i guess its an unmanaged call right, please clear

culguy: hi yan n allen , hi everyone

yhhuang[MS]: for the performance, I think it won't be quicker

Allen[MS]: The performance is not as good as native code.

Deepak: of course, but is it scalable - do we have tangible metrics/numbers to show it performs?

Allen[MS]: COM marshaling and interop mashaling are invovled in the interaction between managed code and native code.

Deepak: sorry, let me make myself clear, I am looking for benchmarks - lets say sending mail using CDO and using native code - now do we have numbers to indicate how much performance hit we take due to interop

Allen[MS]: Please be more specific.

Allen[MS]: We don

yhhuang[MS]: so you need numbers?

Allen[MS]: we have such benchmark in this regards

Deepak: yup - exact performance metrics

Manish: Well for accessing com components in .NET we have RCW, still we see createobject is supported in VB.NET, so i guess its an unmanaged call right, please clearify

Vijay: hi every1

suresh: hello vijay

suresh: ur welcome

Vijay: has the chat session started or not

KunalS[MS]: Yes Vijay it has

yhhuang[MS]: hi

suresh: i think no i just came to this room

yhhuang[MS]: In .NET framework

suresh: ohh..

yhhuang[MS]: if we want to call .com component,

yhhuang[MS]: we need go through InterOp

Vijay: ok

yhhuang[MS]: So I don't think CreateObject is a direct unmanaged way

Pranav76: yhhuang, can you just give us a brief idea about InterOp

rami: Yanhomg.. a quicky.. In dot net components need not to be registerd.. correct? in such case if i want to maintain transactions do i need to use component services window?

if i place the DLLs there will it be registerd or what exactly do component services

Vijay: yhhuang, everytime a question arises whenever i/v think of interop

Manish: hey, but by using createobject, where are the wrappers created

Vijay: whats the performance loss/gain v get when doing this ?

yhhuang[MS]: Pranav76: CLR provides two mechanisms for Interop with unmanaged code

Allen[MS]: InterOp is the way the managed world talks with the naitive world.

yhhuang[MS]: Platform invoke service and COM Interop

Pranav76: whatz the advantages and disadvantages of both

yhhuang[MS]: Vijay: what you can get is from .NET framework

Allen[MS]: We have no benchmarks or exact numbers about the performance hit caused by InterOp,

yhhuang[MS]: such as versioning, code based security......

Pranav76: yeah I can get it

Manish: Yan, if createobject is a managed call, where are the wrappers created

culguy: Allen , when we use System.EnterpriseServices in our managed code, is it all managed code or does it make a umnaged call internally ?

culguy: Allen , when we use System.EnterpriseServices in our managed code, is it all managed code or does it make a unmanaged call internally ?

Allen[MS]: The managed code that lives in COM+ uses InterOp to communicate with the COM+ services.

Pranav76: I have a COM component written using VB and a COM component developed using VB.NET... Can I use these two components in the same way in any of my .NET apps?

yhhuang[MS]: Hi Manish

yhhuang[MS]: I think the job is done by framework

Deepak: Rami> You'll need to do REGSVCS for it to be usable as a COM+ component

Manish: Yes Mr Yan, i m still not clear, if we use CreateObject is the call managed

Allen[MS]: With InterOp you can use the native compoent in the .NET apps. Manish: ok

yhhuang[MS]: Pranav76: yes, you can use both of these two components

Pranav76: but, what is to be done from my side to make it usable??? Is there any specific code to be written for that?? or the .NET framework will take care of that???

Pranav76: you were talking abt Interop helping me in doing that

yhhuang[MS]: Pranav76: For that one implemented by VB, you need to use COM interop

rami: thanks deepak

Manish: Allen, can u point out a case where a COM component will not work correctly in .NET interop

Allen[MS]: Pranav76, to use native code in the .net apps, you need to import it into your project.

yhhuang[MS]: Pranav76: yes. COM Interop can help you use those components developed in VB or VC 6.0

Allen[MS]: You can use the TLBIMP.EXE to do that.

Pranav76: but, is Interop capable of making my VB.NET components usable in my VB projects?

Allen[MS]: Sure.

Pranav76: like what I mean is, if the same VB.NEt component is to be used in my VB app, can it be done?

Allen[MS]: You can use the utility tlbexp to export it to the unmanaged world.

yhhuang[MS]: Pranav76: That is the work of CCW

Pranav76: whatz that (CCW)???

Allen[MS]: COM Callable Wraper.

Pranav76: ohh ok... can u give me some insight on that?

yhhuang[MS]: Pranav76: a CCW is created from a non-collected heap which makes it possible for COM clients to reference the wrapper directly

Pranav76: thats great.. I got it

Saurabh: Allen, I was trying to create a Wrapper around the CDOSYS.dll .. but the wrapper is not being corectly generated.. al the properties are being marked as read-only!! I even tried VS.NET .. but same results .. can you elaborate whats wrong here ??

yhhuang[MS]: Pranav76: The CCW is a proxy for the .NET object being referenced from unmanaged code

Vijay: whats CCW here ???

Pranav76: ohh ok.. is CCW part of .NET framework or what?

Allen[MS]: COM callable wraper.

Vijay: thanx allen

yhhuang[MS]: Pranav76: yes

Allen[MS]: Saurabh, what do you mean by read only?

dk_krishnan: hello everyone

Saurabh: All the properties the are being generated in the wrapper class just have a get accessor ... while the API say's I can set properties also

culguy: Allen , when we use System.EnterpriseServices(for using COM+ in my .NET application) in our managed code, is it all managed code or does it make a umnaged call internally ?

yhhuang[MS]: Saurabh: If I remember right, there is one sample on CDO in Framework SDK

yhhuang[MS]: Saurabh: You can refer to it

Allen[MS]: culguy , it also needs to go through interop

Saurabh: Yes I did refer to it, but I need to interOp with CDOSys.dll, since I need NNTP Support also ...

Pranav76: Can you give me an insight into how COM is different in .NET

Allen[MS]: In your managed com+ component, you dont' have to make any InterOp calls.

yhhuang[MS]: Saurabh: I didn't notice it before. Perhaps we can discuss it offline

Manish: some ActiveX components become terribly slow when used in .NET, why? and how to solve it ?

culguy: thnx allen

Allen[MS]: Actually all your COM+ component will derive from ServicedComponent. which wraps the functions of the IObjectContext and so on.

yhhuang[MS]: Manish: any example?

Allen[MS]: Unmanaged code is Interface-based, while managed code is object based.

Saurabh: yhhuang[MS]: can I get your e-mail address ?? Actually the example in the SDK uses Late Binding ... not Wrapper classes

Allen[MS]: the unmanaged code use GUID to identify a object, while managed code uses strong names to do it.

culguy: allen, so would u say that using COM+ in .NET sacrifices performance ?

Manish: a third party component for skins, dont remember the name, tool a while to site on my form

Allen[MS]: We have reports on the performance issue, but we have no exact numbers.

yhhuang[MS]: Manish: That depends on how it designs. Have you profiled it?

Saurabh: Allen, I don't know if this has been already asked (I came in a bit late), but what's the avg performance difference in using Late Binding and Wrapper classes ( C# as language)??

Manish: not really, instead i dropped the idea of using that control, but why does it happen

Allen[MS]: Personally I have not done such performance comparation.

yhhuang[MS]: Manish: Since it is designed for skin, can be caused by drawing Manish: hmm, possibly

culguy: ok allen

Allen[MS]: latebinding may involes registry lookup, but RCW doens't.

Saurabh: Allen, is that the only performance difference ??? And registry lookp-up might only be when the COM Component is invoked .. right ??

yhhuang[MS]: Saurabh: should happen when being created

Saurabh: Kool, that does not sound to me as a BIG performance difference .... what's the MS recomendations on this use Late Binding or Wrappers ??

Allen[MS]: If you have compile-time metadata, you may want to use the early binding. If you have not, use the Latebinding.

Saurabh: ok!

Saurabh: Also there have been a lot of people debating if while creating new applications from ground-up COM / COM+ should be used or not ? Any words on this ?? Does .NET mark the end of COM components ??

yhhuang[MS]: Mark the end of COM components? No.

Allen[MS]: The .NET is an natural evolution of COM.

dhotiman: can we say that .net is just another way of creating our COM components

Saurabh: So does MS recomend that COm components should be used in the middle tire while creating new .NET Applications ??

Allen[MS]: I remeber Don box has an titled "Is COM dead" in MSDN.

Allen[MS]: you can refer to it.

dhotiman: ok

Saurabh: ok

culguy: can u guys give a example where i might have 2 create a COM component in a .NET application?

Allen[MS]: when you want to use legacy components.

Manish: allen, just a thought, does the .NET framework use any COM comonents ?

Allen[MS]: I am not sure about that.

culguy: let me be more specific, there are no existing COM components to be used, still do u see a situation where i have create a component in VB6

Deepak: Manish, Actually System.DirectoryServices uses Interop

Deepak: its a layer on top of ADSI interfaces - its IMHO not fully native (yet)

yhhuang[MS]: If you want to do something more quickly

Manish: thanks

Allen[MS]: To develop managed component with .NET is fast and effiient, we strongly recommend you to use the power of .NET.

Allen[MS]: any more Qs?

culguy: 1 last q

culguy: there r 3 methods to register a .NET component in COM+, which is the best according to u in terms of performance ?

Allen[MS]: please be more specific.

Sanjay: Hi, Any plans on providing direct support for .NET components in future releases of COM+. I believe right now it goes through the COM Interop.

Allen[MS]: I guess so.

KunalS[MS]: Any more questions coming?

Sanjay: But no specific plans yet?

yhhuang[MS]: Till now, all the COM interop should be go through RCW.

Vijay: RCW ???

Sanjay: The question is that interop thunk will drag the per call performance down, so it makes sense to add managed CLR in COM+?

yhhuang[MS]: RCW is runtime callable wrapper

Allen[MS]: actually managed CLR is named COM+ 2.0 Sanjay: with Windows.NET servers?

culguy: when is it expected 2 b released, COM+ 2.0 ?

yhhuang[MS]: Not been confirmed

Sanjay: Thanx

culguy: thnx

yhhuang[MS]: It seems that most are interested in the performance from COM to .NET

KunalS[MS]: We have another 5 mins, so please shoot of those questions now

dhotiman: thanks

Vijay: yes numbers could help us

Saurabh: yes .. since that's waht most of your clients worry about

Vijay: bcoz v want to see the trade offs between rewriting a COM Component in .NET and losing performance using them as such

yhhuang[MS]: In fact, numbers are different in different scenarios

Vijay: yeah i do understand that

Manish: yeah, but can we get a rough %

Vijay: in one of seminars, Sanjay Vyas was saying

Vijay: its only 15 IL instructions

Vijay: to use COM Interop

Allen[MS]: yes.

Vijay: so does it mean

Vijay: v dont lose much

Manish: thats fine, but the marshalling will take up more time

khozema: hi everybody

Vijay: yes thats true

culguy: agree with manish there

Allen[MS]: it depends.

khozema: hello allen, huang, and kunal

yhhuang[MS]: hi khozema

Allen[MS]: 15 IL is the best we can get.

khozema: sorry for being late

Manish: yeah, well a call will cross the process boundaries (from CLR) invoke the com and get back

Allen[MS]: but if some data need to be marshaled between the two worlds, the performance get hit.

KunalS[MS]: There have been no exact percentage numbers that have been yet published

KunalS[MS]: that mark the performance upgrade...

KunalS[MS]: but the moment we have some definite nos., we shall share them with you

Manish: cool

culguy: i think most of us would want 2 use COM+ , since COM Interop is the only way, people would think abt performance , it would b nice if Microsoft could give us all some numbers

KunalS[MS]: So I believe there are no more questions for our experts.

Saurabh: awaiting the reults

KunalS[MS]: but surprisingly

KunalS[MS]: what limits you from

yhhuang[MS]: Nice to meet you all today

KunalS[MS]: using COM .NET Interop - the performance hit?

Saurabh: Yes, Kunal !!

Manish: thats the main concern kunal

KunalS[MS]: is that the main issue of concern here? or is it the ease of not having develop your components afresh!

culguy: yes, as saurabh said initially his clients r concrned abt it

Manish: component are ment to be reused , why reinvent the wheel

Saurabh: Kunal .. if I use COM Intero .. and there is a BIG performance Hit then may be I will have to shift my attention towards creating new native .NET Components

KunalS[MS]: i agree...but in all you opinion

KunalS[MS]: is the performance hit so much that you need to consider building fresh components?

KunalS[MS]: i dont think so!

Manish: I feel there should be more components bundled with Vs.NET or available from MS like we had for ActiveX controls

Saurabh: That's what we don't know !! Tha's why need the figures from MS !!

culguy: that's what I want 2 know, exactly how much difference is there

KunalS[MS]: What do your clients say?

KunalS[MS]: There is one scenario of numbers which give us exact differences...

KunalS[MS]: the other is that there is an apparent hit in performance, numbers just justify

culguy: even, we as developers and architects hav 2 think twice b4 using COM+ in a .NET application

Vijay: yes true culguy

Vijay: if performance goes even my little that too in a web app

Vijay: u lose ur customers

Vijay: that too to our competitors

Saurabh: Kunal .. we as developers understand things... but as you know clients are always too cautious of NEW technologies .. they won't take our words ... they will simply say give proof !!

KunalS[MS]: but the COM - .NET Interop is not a permanent solution

Vijay: yes, true, thats what v face

Vijay: 24 * 7

Vijay: so some documentation from a company like MS

Vijay: will help us

KunalS[MS]: it is a bridge for your customers to move there systems in a phased manner

KunalS[MS]: and that is what you need to explain to your customers

Vijay: u can benchmark of any one of ur sampel application

Vijay: and just host them on the site

chinese-guy: hi all, i'm looking for a friend in dubai

Saurabh: Kunal, that's what I was trying to ask earlier if COM development was dead!!

KunalS[MS]: The customer understands that there is a apparent business benefit

Manish: hmmmm

KunalS[MS]: in moving to .NET

KunalS[MS]: but if you tell the customer

KunalS[MS]: that it is a rip and refit solution

KunalS[MS]: it is not possible to implement the solution

IsolaRam: I have some Engineering items for distributors invited

KunalS[MS]: the idea is to provide the customer with a technolgy growth path

Vijay: see kunal, customers dont understand as v developers do

Vijay: v understand ur language bcoz v hv been breathing, living, sleeping technology

KunalS[MS]: Vijay, what customers understand is return on inventment

KunalS[MS]: investment

Vijay: yes u r rite

IsolaRam: any one interested in distributorship

KunalS[MS]: and Total Cost Of Ownership

Vijay: yes

Vijay: yes ROI, TCO is whats they breate

KunalS[MS]: if you explain to the customer

KunalS[MS]: that this the way to move their systems

KunalS[MS]: in a phased manner to a paradigm om computing

KunalS[MS]: then they understand

Vijay: k

Vijay: so what v hv to do is

KunalS[MS]: no CTO can afford to rip and replace!

Vijay: write .NET apps that will use existing COM/COM+ code

KunalS[MS]: COM - .NET Interop is the answer to a roadmap of implementation

Vijay: and then v will slowly do rip and replace in a phased manner

Vijay: is that rite ?

KunalS[MS]: Right Said Fred!

KunalS[MS]: Alright guys,

KunalS[MS]: thank you very much for your time

Vijay: thanx kunal

Manish: THanks Allen,Yon-huang and Kunal

Vijay: u r doing gr8

Vijay: work

KunalS[MS]: we shall try and get back to you with some numbers on the performance front

Saurabh: thanks

culguy: thnx yan, allen, kunal

KunalS[MS]: For all those present

KunalS[MS]: the next weeks chat is on
KunalS[MS]: XML Web Services and Interoperability

Manish: we will be there

KunalS[MS]: and shall be conducted by

Manish: thanks again

Manish: bye

Vijay: oh gr8 yaar

KunalS[MS]: Ashutosh Danesha

KunalS[MS]: Lead .NET Evangelist

KunalS[MS]: MS India

KunalS[MS]: he is from MS Redmond

Saurabh: good topic .. actually very very intresting ...

Vijay: yes very intresting

Vijay: thanx kunal

KunalS[MS]: and has been part of the initial CLR Development Team

KunalS[MS]: Bye all of you and thanks once again

Vijay: oh gr8 kunal, u bring gr8 people to enlighten us

Vijay: bye

culguy: bye
     

©2009 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy Statement
Microsoft