.NETGURU
regsvcs and FCL types
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.component_services.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Kim Gräsman
Hi all,

I've just recently started playing with Serviced Components in C#.

I've defined a type like:

[Guid(...)]
public interface IFoo
{
void Method();
}

[Guid(...)]
public class Foo : ServicedComponent, IFoo
{
public void Method()
{
// ...
}
}

When I run regsvcs.exe on the resulting assembly, the type is registered in
COM+ as expected, but so are a number of FCL interfaces and classes;

- _Object
- IDisposable
- IManagedObject
- IRemoteDispatch
- System_EnterpriseServices_IServicedComponentInfo

Also, regsvcs seems to synthesize an interface called _Foo from the class
definition, rather than emitting just IFoo.
None of the FCL types end up in the generated typelib, they are only shown
in the COM+ MMC snap-in.

Is there any way I can suppress the creation of these types, or am I missing
something fundamental?

--
Best regards,
Kim Gräsman

Reply to this message...
 
    
Tomas Restrepo \(MVP\) (VIP)
Hi Kim!

[Original message clipped]

That one is easy. Add another attribute to Foo:
[ ClassInterface(ClassInterfaceType.None) ]
which tells regsvcs to use the interface, and not sintetize a dual interface
instead (and the name suggest it tries to be VB6-like in doing so ;)).

As for the rest of the interfaces, they are needed for a few internal
framwork things, I believe... spelunking with anakrino inside
System.EnterpriseServices.Dll is quite interesting ;)
--
Tomas Restrepo
Click here to reveal e-mail address

Reply to this message...
 
    
Kim Gräsman
Hi Tomas!

> > Also, regsvcs seems to synthesize an interface called _Foo from the
class
[Original message clipped]

Cool - thanks! Yeah, that underscore nightmare seems to have no end ;)

[Original message clipped]

I don't mind much, it's just disturbing to the eye. It reminds me of
including shared interfaces in a typelib of the component implementing them,
which can break typelib marshalling. But I assume there's no problem with
running multiple applications with these classes in parallel?

Thanks!

--
Best regards,
Kim Gräsman

Reply to this message...
 
    
Tomas Restrepo \(MVP\) (VIP)
Hi Kim,

[Original message clipped]

There shouldn't, but, overall, remember that this is still COM+ at the
bottom of the stack, meaning the restriction of having one ServicedComponent
in registerd in only one COM+ application at a time (barring the use of COM+
partitions).

--
Tomas Restrepo
Click here to reveal e-mail address

Reply to this message...
 
    
Kim Gräsman
Tomas,

[Original message clipped]

I know, that's why I was a bit disturbed by the fact that regsvcs forced the
managed classes into the app... I thought maybe I was doing something wrong,
but I guess it's the way it should be.

Thanks!

--
Best regards,
Kim Gräsman

Reply to this message...
 
 
System.EnterpriseServices.IRemoteDispatch
System.EnterpriseServices.IServicedComponentInfo
System.EnterpriseServices.ServicedComponent
System.IDisposable
System.Runtime.InteropServices.ClassInterfaceType




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification