HighTechTalks DotNet Forums  

regsvcs and FCL types

Dotnet Framework (Component Services) microsoft.public.dotnet.framework.component_services


Discuss regsvcs and FCL types in the Dotnet Framework (Component Services) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Kim Gräsman
 
Posts: n/a

Default regsvcs and FCL types - 07-19-2004 , 08:50 AM






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 With Quote
  #2  
Old   
Tomas Restrepo \(MVP\)
 
Posts: n/a

Default Re: regsvcs and FCL types - 07-19-2004 , 09:56 PM






Hi Kim!

Quote:
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.
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
tomasr (AT) mvps (DOT) org




Reply With Quote
  #3  
Old   
Kim Gräsman
 
Posts: n/a

Default Re: regsvcs and FCL types - 07-20-2004 , 03:52 AM



Hi Tomas!

Quote:
Also, regsvcs seems to synthesize an interface called _Foo from the
class
definition, rather than emitting just IFoo.

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 ).
Cool - thanks! Yeah, that underscore nightmare seems to have no end

Quote:
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
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 With Quote
  #4  
Old   
Tomas Restrepo \(MVP\)
 
Posts: n/a

Default Re: regsvcs and FCL types - 07-20-2004 , 01:13 PM



Hi Kim,

Quote:
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?
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
tomasr (AT) mvps (DOT) org




Reply With Quote
  #5  
Old   
Kim Gräsman
 
Posts: n/a

Default Re: regsvcs and FCL types - 07-21-2004 , 03:25 AM



Tomas,

Quote:
But I assume there's no problem with
running multiple applications with these classes in parallel?

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).
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 With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.