473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Registration problem with COM interop sample.

Hi,

I'm using the the MSDN sample "COM Interop Part 2 Sample"
(CSharpServerWithCOMClient.sln). The C# COM component gets registered when
the solution is built. Somehow the component doesn't get registered properly.
When opened with OLE/COM Viewer the component throws up an error saying:

"CoGetClassObject failed.
The system cannot find the file specified.
severity: SEVERITY_ERROR, facility: FACILITY_WIN32($80070002)"

Not sure what is going wrong. Appreciate any help. Is there anything
specific that needs to be done?

TIA,
SD

Apr 19 '07 #1
3 9883
SD,

Nothing is going wrong. The assembly produced by .NET is still a .NET
assembly. If you look at the registry entries for your component that is
registered for COM interop, you will see that the InProcServer32 value
doesn't point to your component, but rather points to a framework component.
This is because COM interop is handled through the CLR, and not baked into
your .NET component.

That's why OLEView fails. It's trying to read a .NET component as a COM
component, when that isn't the case.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"SD" <SD@discussions.microsoft.comwrote in message
news:4D**********************************@microsof t.com...
Hi,

I'm using the the MSDN sample "COM Interop Part 2 Sample"
(CSharpServerWithCOMClient.sln). The C# COM component gets registered when
the solution is built. Somehow the component doesn't get registered
properly.
When opened with OLE/COM Viewer the component throws up an error saying:

"CoGetClassObject failed.
The system cannot find the file specified.
severity: SEVERITY_ERROR, facility: FACILITY_WIN32($80070002)"

Not sure what is going wrong. Appreciate any help. Is there anything
specific that needs to be done?

TIA,
SD

Apr 19 '07 #2
"SD" <SD@discussions.microsoft.comwrote in message
news:4D**********************************@microsof t.com...
Hi,

I'm using the the MSDN sample "COM Interop Part 2 Sample"
(CSharpServerWithCOMClient.sln). The C# COM component gets registered when
the solution is built. Somehow the component doesn't get registered properly.
When opened with OLE/COM Viewer the component throws up an error saying:

"CoGetClassObject failed.
The system cannot find the file specified.
severity: SEVERITY_ERROR, facility: FACILITY_WIN32($80070002)"

Not sure what is going wrong. Appreciate any help. Is there anything
specific that needs to be done?

TIA,
SD

This: 80070002 means "File not found", so the Client (COM) is not able to locate the server
DLL.
To resolve you have several options:
- install the client in the same location as the DLL, or
- register the DLL using " regasm.exe" with the /codebase switch from the command line, or
- install the DLL in the GAC, using gacutil.exe.

Willy.

Apr 19 '07 #3
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in message
news:OL**************@TK2MSFTNGP06.phx.gbl...
SD,

Nothing is going wrong. The assembly produced by .NET is still a .NET assembly. If
you look at the registry entries for your component that is registered for COM interop,
you will see that the InProcServer32 value doesn't point to your component, but rather
points to a framework component. This is because COM interop is handled through the CLR,
and not baked into your .NET component.

That's why OLEView fails. It's trying to read a .NET component as a COM component,
when that isn't the case.

Hope this helps.
This is not true, if you *register a .NET assembly as a COM component either from VS or by
using regasm, you are registering mscoree.dll as the COM server and your assembly and
class(es) as a COM class(es) (both as InProcServers).
mscoree is the shim that loads the CLR, so when you start OLEVIEW, mscoree will load and
this one will automatically load the CLR as a result of a call into COM (the creation of an
instance of your .NET class).
If however, your assembly is not in the clienst path, mscoree.dll will not be able to locate
your assembly and this will produce the HRESULT as mentioned by the OP. One way to solve
this is by applying the codebase switch to regasm or installing the assembly in the GAC.

Willy.
Apr 19 '07 #4

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

Similar topics

0
by: Johan Henningsson | last post by:
Hello, when I try to compile .net projects that is using interop then they fail. I get this error: "COM Interop registration failed. Could not load the assembly to be registered." What can...
0
by: Janus Kamp Hansen | last post by:
I have had this error: 'COM Interop registration failed. Type library exporter can not load required library MSCOREE.TLB.' I have found a solution, by using the Regmon tool...
1
by: Nadav | last post by:
Hi, Introduction: **************** I have created a .NET COM interop Assembly, this assembly references another COM object. The Problem: ***************** To enable registration of the...
2
by: Peter | last post by:
Hello Thanks for reviewing my question. I am writing a shared Office AddIn that uses a couple of user controls on a form and from time to time I receive this error "COM Interop registration...
5
by: Eric St-Onge | last post by:
Hi all, I have a C# DLL containing only interfaces that I want to have a TLB (type library) generated for. For that I use the "Register for COM Interop" compiler option but it gives me the...
0
by: Mark | last post by:
I have created a library that exposes classes to COM clients using the attribute . My library references 2 other libraries, lib1 and lib2, both of which are created by other developers on my...
0
by: zoneal | last post by:
I am having two problems concerning COM Interop Registration: While building a project (COM DLL) that has reference to other DLL project (not COM). I getting this error: COM Interop...
3
by: SteveS | last post by:
Recently I changed computers and had to reinstall Visual Studio. After this, a solution that used to compile and produce a COM callable DLL now produces the error message: "COM Interop...
1
by: Shotor | last post by:
I must register and unregister the TLB-File of a .NET-COM-Assemblies (Interop). To do that I can not use whether the Microsoft-Tool REGASM.EXE nor Windows-Installer. I can use only WIN32-API or...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.