473,549 Members | 3,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reference COM component fails in Visual Studio (ResolveComRefe rence exception)

Hi,

I am trying to reference a COM component (.dll) from Visual Studio 2005
in my windows application in C# by adding a reference to a third
party.dll file (tried .type library also), and i get this error from
the compiler when trying to compile the solution.

Does anyone know why this occurs, and how it can be resloved, i would
be very grateful indeed.

Here comes the exception thrown:
------------------------------------------
Error 2 The "ResolveComRefe rence" task failed unexpectedly.
System.SystemEx ception: The type library importer encountered an error
during type verification. Try importing without class members. --->
System.TypeLoad Exception: Method 'IXorDiscountMa trix_GetName' on type
'XOR5.CXorDisco untMatrixClass' from assembly 'Interop.XOR5,
Version=1.0.0.0 , Culture=neutral , PublicKeyToken= null' is overriding a
method that has been overridden.
at System.Reflecti on.Module.Inter nalLoadInMemory TypeByName(Stri ng
className)
at
System.Runtime. InteropServices .TypeLibConvert er.TypeResolveH andler.ResolveE vent(Object
sender, ResolveEventArg s args)
at System.AppDomai n.OnTypeResolve Event(String typeName)
--- End of inner exception stack trace ---

Server stack trace:
at
System.Runtime. InteropServices .TypeLibConvert er.nConvertType LibToMetadata(O bject
typeLib, AssemblyBuilder asmBldr, ModuleBuilder modBldr, String
nameSpace, TypeLibImporter Flags flags, ITypeLibImporte rNotifySink
notifySink, ArrayList& eventItfInfoLis t)
at
System.Runtime. InteropServices .TypeLibConvert er.ConvertTypeL ibToAssembly(Ob ject
typeLib, String asmFileName, TypeLibImporter Flags flags,
ITypeLibImporte rNotifySink notifySink, Byte[] publicKey,
StrongNameKeyPa ir keyPair, String asmNamespace, Version asmVersion)
at
Microsoft.Build .Tasks.TlbRefer ence.GenerateWr apper(ComRefere nceWrapperInfo&
wrapperInfo)
at
Microsoft.Build .Tasks.ResolveC omReference.Res olveComReferenc eTlb(ComReferen ceInfo
referenceInfo, String outputDirectory , String refName, Boolean
topLevelRef, ComReferenceWra pperInfo& wrapperInfo)
at
Microsoft.Build .Tasks.ResolveC omReference.Res olveComClassicR eference(ComRef erenceInfo
referenceInfo, String outputDirectory , String wrapperType, String
refName, Boolean topLevelRef, ComReferenceWra pperInfo& wrapperInfo)
at
Microsoft.Build .Tasks.ResolveC omReference.Res olveReference(C omReferenceInfo
referenceInfo, String outputDirectory , ITaskItem& referencePathIt em)
at
Microsoft.Build .Tasks.ResolveC omReference.Res olveReferenceAn dAddToList(ComR eferenceInfo
projectRefInfo, ArrayList resolvedReferen ceList, ArrayList moduleList)
at Microsoft.Build .Tasks.ResolveC omReference.Exe cute()
at
System.Runtime. Remoting.Messag ing.StackBuilde rSink._PrivateP rocessMessage(I ntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInConte xt, Object[]& outArgs)
at
System.Runtime. Remoting.Messag ing.StackBuilde rSink.PrivatePr ocessMessage(Ru ntimeMethodHand le
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInConte xt, Object[]& outArgs)
at
System.Runtime. Remoting.Messag ing.StackBuilde rSink.SyncProce ssMessage(IMess age
msg, Int32 methodPtr, Boolean fExecuteInConte xt)

Exception rethrown at [0]:
at
System.Runtime. Remoting.Proxie s.RealProxy.Han dleReturnMessag e(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime. Remoting.Proxie s.RealProxy.Pri vateInvoke(Mess ageData&
msgData, Int32 type)
at Microsoft.Build .Framework.ITas k.Execute()
at Microsoft.Build .BuildEngine.Ta skEngine.Execut eTask(Execution Mode
howToExecuteTas k, Hashtable projectItemsAva ilableToTask,
BuildPropertyGr oup projectProperti esAvailableToTa sk, Boolean&
taskClassWasFou nd) Control.Import. Filter
Sincerely
/Hans Sixhöj
Software Developer

Feb 3 '06 #1
4 10813
Run tlbimp.exe on the DLL/TLB. When you do, use the /noclassmembers
option, so that class members are not created from the implemented
interfaces. It looks like there are two interfaces with similar method
signatures which are giving you problems.

This will remove the members from the class (so all you do is use it to
create the object). It will require you to cast to the appropriate
interface to access the methods exposed by the object.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<ff******@hotma il.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Hi,

I am trying to reference a COM component (.dll) from Visual Studio 2005
in my windows application in C# by adding a reference to a third
party.dll file (tried .type library also), and i get this error from
the compiler when trying to compile the solution.

Does anyone know why this occurs, and how it can be resloved, i would
be very grateful indeed.

Here comes the exception thrown:
------------------------------------------
Error 2 The "ResolveComRefe rence" task failed unexpectedly.
System.SystemEx ception: The type library importer encountered an error
during type verification. Try importing without class members. --->
System.TypeLoad Exception: Method 'IXorDiscountMa trix_GetName' on type
'XOR5.CXorDisco untMatrixClass' from assembly 'Interop.XOR5,
Version=1.0.0.0 , Culture=neutral , PublicKeyToken= null' is overriding a
method that has been overridden.
at System.Reflecti on.Module.Inter nalLoadInMemory TypeByName(Stri ng
className)
at
System.Runtime. InteropServices .TypeLibConvert er.TypeResolveH andler.ResolveE vent(Object
sender, ResolveEventArg s args)
at System.AppDomai n.OnTypeResolve Event(String typeName)
--- End of inner exception stack trace ---

Server stack trace:
at
System.Runtime. InteropServices .TypeLibConvert er.nConvertType LibToMetadata(O bject
typeLib, AssemblyBuilder asmBldr, ModuleBuilder modBldr, String
nameSpace, TypeLibImporter Flags flags, ITypeLibImporte rNotifySink
notifySink, ArrayList& eventItfInfoLis t)
at
System.Runtime. InteropServices .TypeLibConvert er.ConvertTypeL ibToAssembly(Ob ject
typeLib, String asmFileName, TypeLibImporter Flags flags,
ITypeLibImporte rNotifySink notifySink, Byte[] publicKey,
StrongNameKeyPa ir keyPair, String asmNamespace, Version asmVersion)
at
Microsoft.Build .Tasks.TlbRefer ence.GenerateWr apper(ComRefere nceWrapperInfo&
wrapperInfo)
at
Microsoft.Build .Tasks.ResolveC omReference.Res olveComReferenc eTlb(ComReferen ceInfo
referenceInfo, String outputDirectory , String refName, Boolean
topLevelRef, ComReferenceWra pperInfo& wrapperInfo)
at
Microsoft.Build .Tasks.ResolveC omReference.Res olveComClassicR eference(ComRef erenceInfo
referenceInfo, String outputDirectory , String wrapperType, String
refName, Boolean topLevelRef, ComReferenceWra pperInfo& wrapperInfo)
at
Microsoft.Build .Tasks.ResolveC omReference.Res olveReference(C omReferenceInfo
referenceInfo, String outputDirectory , ITaskItem& referencePathIt em)
at
Microsoft.Build .Tasks.ResolveC omReference.Res olveReferenceAn dAddToList(ComR eferenceInfo
projectRefInfo, ArrayList resolvedReferen ceList, ArrayList moduleList)
at Microsoft.Build .Tasks.ResolveC omReference.Exe cute()
at
System.Runtime. Remoting.Messag ing.StackBuilde rSink._PrivateP rocessMessage(I ntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInConte xt, Object[]& outArgs)
at
System.Runtime. Remoting.Messag ing.StackBuilde rSink.PrivatePr ocessMessage(Ru ntimeMethodHand le
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInConte xt, Object[]& outArgs)
at
System.Runtime. Remoting.Messag ing.StackBuilde rSink.SyncProce ssMessage(IMess age
msg, Int32 methodPtr, Boolean fExecuteInConte xt)

Exception rethrown at [0]:
at
System.Runtime. Remoting.Proxie s.RealProxy.Han dleReturnMessag e(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime. Remoting.Proxie s.RealProxy.Pri vateInvoke(Mess ageData&
msgData, Int32 type)
at Microsoft.Build .Framework.ITas k.Execute()
at Microsoft.Build .BuildEngine.Ta skEngine.Execut eTask(Execution Mode
howToExecuteTas k, Hashtable projectItemsAva ilableToTask,
BuildPropertyGr oup projectProperti esAvailableToTa sk, Boolean&
taskClassWasFou nd) Control.Import. Filter
Sincerely
/Hans Sixhöj
Software Developer
Feb 3 '06 #2
Hi,

Thanks for your fast response, it worked to create a new .dll file.

The original .dll file (in COM) belongs to a program not built by me. I
need to respond to events triggered in this application when the user
performs different actions (worked in VB) (listen to events from an
interface). Will this be possible although i have created a new .dll
file?

If not, is there a way to achive this?

Sincerely
/Hans Sixhöj
Systems Developer

Feb 3 '06 #3
Hans,

Well, when you set a reference in Visual Studio .NET, you are still
creating your own interop DLL to use. What you are doing here is no
different, you just have more options available to you.

So yes, you should have access to all of the functionality exposed by
the object.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<ff******@hotma il.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi,

Thanks for your fast response, it worked to create a new .dll file.

The original .dll file (in COM) belongs to a program not built by me. I
need to respond to events triggered in this application when the user
performs different actions (worked in VB) (listen to events from an
interface). Will this be possible although i have created a new .dll
file?

If not, is there a way to achive this?

Sincerely
/Hans Sixhöj
Systems Developer
Feb 3 '06 #4
Thank you for your answers.

The issue has been resolved.

Thank you very much.

Sincerely,
/Hans Sixhöj
Software Developer

Feb 3 '06 #5

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

Similar topics

2
10529
by: Pkpatel | last post by:
Hi, I keep getting this error every time I try to load crystalreportviewer on a webform with a dataset. Here is the error: -------------------------------------------------------- Server Error in '/Cr_Dataset' Application. ----------------------------------------------------------- ---------------------
6
741
by: jemmaq99 | last post by:
Using Visual Studio .NET 2003 I've tried to add a COM reference to a Windows Form project via the Add Reference dialog (specifically the Active DS Type Library) but always get the error message: "A reference to 'Active DS Type Library' could not be added. The type library wrapper tool 'tlbimp' cannot be found on this system. Please...
6
1991
by: Ali-R | last post by:
I'm using a .Net application to execute DTS packages within Sqlserver,I need to have very customizable and powerful Exception maangement systems which loggs different issues happend in the DTS package with my own errorCode. Can somebody give me some ideas? Thanks
7
3882
by: TJ | last post by:
In C# how do you achieve pass-by-reference property declarations in the Type Library? I am writing a COM Class Library that must mimick an existing library for which the only information is the TypeLib. I'm using Visual Studio .NET 2003. The original library provides simple authentication services, from Access and MS-SQL OLEDB providers....
6
37783
by: **Developer** | last post by:
What does this mean: External component has thrown an exception. My program crashes after it leaves a subroutine. What I see during debugging is when I press F11 at the End Sub statement
8
5438
by: cd~ | last post by:
I can provide a test app, the news server won't allow me to post the files because they are too large (93KB and 1.2KB) I downloaded the ESRI ArcXml schema and generated the classes from the schema using xsd.exe, which took a while because xsd doesn't handle recursive elements very well (StackOverFlow exception during generation). Now that I...
4
3315
by: =?Utf-8?B?V2lsbWVyIEhlcm5hbmRleg==?= | last post by:
An ActiveX component created using ATL under Visual Studio 2003, and it is used in a ASP, runs perfectly under administrator or power users group, however this same object does not run under the Users groups. I see this problem happen in Internet Explorer 6 and 7 under windows XP. Under the Users group the component fails when it tries to...
1
1449
by: diego | last post by:
I have the follwing problem. I want to add a reference to an COM- object ("ek1.exe"). In Excel-VBA it works without any problems. In MS Visual Studio 2005 VB this doesn't work and I get the error message: "A reference to 'z:\ek.exe' could not be added. Please make sure that the file is accessible, and that is a valid assembly or COM
0
884
by: mattmcgregor | last post by:
I'm using Visual Studio 2008 and have got a project with the following: Web Service (on a server): 1 web method that returns an xml list of files stored on the server. It references Component A to return that list. Win Forms App (laptop): Has a local file list that I want to compare to the server list. The win app references Component A to...
0
7526
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...
0
7723
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. ...
0
7962
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...
1
7480
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7814
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...
0
6050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5373
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...
0
3504
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.