471,344 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

TypeResolve & GetType()

I've a piece of code which does Type.GetType("full.type, name") on a
type that is located in an assembly that is currently not loaded.
I don't have control over the code that call this and I don't have any
control on the string that get passed.
I wanted to use TypeResolve to handle this, but it doesn't get call for
static assemblies.

Any ideas how I can handle this?

Aug 9 '05 #1
5 2170
This event is not called if the runtime knows that requested type cannot be
retieved from an assembly. Does the type you're requesting exists in the
assembly?
--
Vadym Stetsyak aka Vadmyst
<ay****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I've a piece of code which does Type.GetType("full.type, name") on a
type that is located in an assembly that is currently not loaded.
I don't have control over the code that call this and I don't have any
control on the string that get passed.
I wanted to use TypeResolve to handle this, but it doesn't get call for
static assemblies.

Any ideas how I can handle this?

Aug 10 '05 #2
It exists, but the assembly is not loaded, that is the problem.

Aug 10 '05 #3
If the type exists in the assembly then it seems to me that assembly is not
loaded.

Can you try to load that assembly manually and call Assembly.GetType(...)?

Also you can subscribe to AppDomain.AssemblyResolve to get notified if
something bad is happening with assembly load.

--
Vadym Stetsyak aka Vadmyst

<ay****@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
It exists, but the assembly is not loaded, that is the problem.

Aug 11 '05 #4
ay****@gmail.com wrote:
I've a piece of code which does Type.GetType("full.type, name") on a
type that is located in an assembly that is currently not loaded.
I don't have control over the code that call this and I don't have any
control on the string that get passed.
I wanted to use TypeResolve to handle this, but it doesn't get call for
static assemblies.

Any ideas how I can handle this?

use AssemblyName class to parse the ClassName, & load the assembly if
needed.
Aug 14 '05 #5
I'm already subscribing to AssemblyResolve, but it's not getting
called, and I don't know why.

Aug 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Shmuel Cohen | last post: by
3 posts views Thread by Fredrik Wahlgren | last post: by
3 posts views Thread by ayende | last post: by
12 posts views Thread by Michael Maes | last post: by
4 posts views Thread by marcmc | last post: by

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.