HighTechTalks DotNet Forums  

Com Interop and Type.GetType

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Com Interop and Type.GetType in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Mwob
 
Posts: n/a

Default Com Interop and Type.GetType - 06-05-2007 , 09:14 AM






Hi,

I am using the Microsoft Caching Block with the database as a backend
store, and all works fine under .NET. I am trying to get the same code
to work when my assembly is called via COM Interop from a VB6 client.
When this happens, the caching block falls over because a call to
Type.GetType has failed to load the required assembly. The Assembly is
fully qualified like this:

Microsoft.Practices.EnterpriseLibrary.Caching.Data base.DataBackingStore,
Microsoft.Practices.EnterpriseLibrary.Caching.Data base,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null

The code looks like this:

Type providerType = Type.GetType(typeName, false);

Quote:
From what I understand, Type.GetType tries to load the assembly when
GetType is called, so in a normal app it would look in the "debug"
folder if running in debug, and probably the GAC too... But because
this is COM INterop, I don't understand where .NET is looking for the
assembly, and I'm not sure what I can do - perhaps force it to look
somewhere else perhaps?


Can anyone help me?



Matt.



Reply With Quote
  #2  
Old   
Mwob
 
Posts: n/a

Default Re: Com Interop and Type.GetType - 06-06-2007 , 03:52 AM






Thanks, I realised this soon after I posted. Unfourtuntely its not so
simple for me - rather than a VB Client exe calling through to
the .NET assembly, it will be a COM component which in turn will be
instantiated from an ASP page.

So, because it goes ASP -> COM -> .NET Assembly -> Caching block, the
caching block looks for the assembly in C:\windows\system32
(presumably because the ASP process (DLLHOST.EXE) is in that folder).

I'm completely stuck - I want to tell the Caching block to load the
assembly from a folder where I know it will be, not in system32. But I
don't know how to do this, or if its possible. I toyed with the idea
of adding the caching block to the GAC, but its heavily bound to the
rest of the enterprise block so even this isn't easy to do.

Any ideas?

On 5 Jun, 19:49, Mattias Sjögren <mattias.dont.want.s... (AT) mvps (DOT) org>
wrote:
Quote:
From what I understand, Type.GetType tries to load the assembly when
GetType is called, so in a normal app it would look in the "debug"
folder if running in debug, and probably the GAC too... But because
this is COM INterop, I don't understand where .NET is looking for the
assembly, and I'm not sure what I can do - perhaps force it to look
somewhere else perhaps?

It will still look in the application directory, but in this case that
means the VB6 application directory (or the VB directory if you're
running from inside the IDE).

Fuslogvw.exe is a great little tool in the .NET SDK for finding the
cause of binding failures.

Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
Please reply only to the newsgroup.



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.