DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 07 Aug 2007 11:10:11 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    unknown
          2    unknown
          3    unknown
          4    unknown


.NET interface not appearing in COM+ app... help?   
Hi all.  I have a .NET component that implements several interfaces
and derives from ServicedComponent.  It has a fixed GUID and ProgID.
Everything was working great, and then I implemented a new interface,
IConnectionPointContainer, with this component.  Now when I register
it using regsvcs, I get a COM+ application, but the
IConnectionPointContainer interface is missing!

I don't think this is anything related to IConnectionPointContainer,
as I tried creating a simple test interface and got the same results.
Any ideas why interfaces I add don't show up in the COM+ application?

I've tried having the .NET component be installed in the GAC, not
installed in the GAC, changing the order of interface declarations
(getting desperate...), deleting the COM+ application and rebooting
before re-installing.... nothing seems to help.  I'm probably missing
something obvious but for the life of me I can't figure it out.

Thanks!

Carl
Date:Tue, 07 Aug 2007 11:10:11 -0700   Author:  

Re: .NET interface not appearing in COM+ app... help?   
Still have no idea on this one, but I've been able to create a simple
example that reproduces the problem.  I just created a new C# library
project and added the following class:

------
using System;
using System.Collections.Generic;
using System.Text;
using System.EnterpriseServices;
using System.Runtime.InteropServices.ComTypes;

namespace InterfaceTest
{
	public class TestComponent : ServicedComponent,
IConnectionPointContainer
	{

		#region IConnectionPointContainer Members

		void IConnectionPointContainer.EnumConnectionPoints(out
IEnumConnectionPoints ppEnum)
		{
			ppEnum = null;
		}

		void IConnectionPointContainer.FindConnectionPoint(ref Guid riid,
out IConnectionPoint ppCP)
		{
			ppCP = null;
		}

		#endregion
	}
}
------

To the assembly.cs file I added/changed the following properties:

------
[assembly: ComVisible(true)]

[assembly: ApplicationName("TestComponent")]
[assembly: Description("Test component")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: ApplicationAccessControl(Value = true,
									Authentication = AuthenticationOption.Integrity,
									ImpersonationLevel = ImpersonationLevelOption.Identify,
									AccessChecksLevel =
AccessChecksLevelOption.ApplicationComponent)]
------

I then built the DLL and ran regsvcs on it ("regsvcs
InterfaceTest.dll").

Looking in the COM+ application (through Component Services) I see
that IConnectionPointContainer is *not* listed as one of the
interfaces.  Can someone confirm this result?  Is this expected?  I
need COM-based clients to be able to CoCreate my component using this
interface, and right now they are unable to do so.

Playing around with my original app, I found I could remove and re-add
interfaces that do show up in the COM+ application, and they behave as
expected. I could not get IConnectionPointContainer or a newly created
interface to show no matter what I did.

Carl
Date:Tue, 07 Aug 2007 16:16:41 -0700   Author:  

Re: .NET interface not appearing in COM+ app... help?   
I have a workaround for this and am posting it here so that it might
help someone else.  If anyone can explain why this works I'd
appreciate it.  My guess is it has to do with the COM visibility of
the assembly that contains the System.Runtime.InteropServices.COMTypes
interfaces (which appear to be the System assembly, which has its
ComVisible attribute set to false).

What I did was manually define the interfaces in my assembly:

	[Guid("B196B287-BAB4-101A-B69C-00AA00341D07")]
	[InterfaceType(1)]
	public interface IEnumConnections
	{
		void Clone(out IEnumConnections ppenum);
		int Next(int celt, CONNECTDATA[] rgelt, IntPtr pceltFetched);
		void Reset();
		int Skip(int celt);
	}

	[Guid("B196B286-BAB4-101A-B69C-00AA00341D07")]
	[InterfaceType(1)]
	public interface IConnectionPoint
	{
		void Advise(object pUnkSink, out int pdwCookie);
		void EnumConnections(out IEnumConnections ppEnum);
		void GetConnectionInterface(out Guid pIID);
		void GetConnectionPointContainer(out IConnectionPointContainer
ppCPC);
		void Unadvise(int dwCookie);
	}

	[Guid("B196B285-BAB4-101A-B69C-00AA00341D07")]
	[InterfaceType(1)]
	public interface IEnumConnectionPoints
	{
		void Clone(out IEnumConnectionPoints ppenum);
		int Next(int celt, IConnectionPoint[] rgelt, IntPtr pceltFetched);
		void Reset();
		int Skip(int celt);
	}

	[Guid("B196B284-BAB4-101A-B69C-00AA00341D07")]
	[InterfaceType(1)]
	public interface IConnectionPointContainer
	{
		void EnumConnectionPoints(out IEnumConnectionPoints ppEnum);
		void FindConnectionPoint(ref Guid riid, out IConnectionPoint ppCP);
	}

Then IConnectionPointContainer appeared as an interface in the COM+
application.
Date:Wed, 08 Aug 2007 10:31:06 -0700   Author:  

Re: .NET interface not appearing in COM+ app... help?   
This is a really bad solution -- it overwrites the registry entries
for the COM versions of these interfaces and messes things up.  Don't
do it.  I'm back to the problem of not being able to see this
interface in COM+.
Date:Fri, 10 Aug 2007 12:33:33 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us