[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

nay

12/10/2002 9:29:00 AM

Hi!
I try to run the following code:

assem = System.Reflection.Assembly.LoadFrom("Full Path of
dll")
classType = assem.GetType("Namespace.ClassName")
obj = Activator.CreateInstance(classType, True)

2 kinds of exception message are thrown from The last
line: ArgumentException, and the
message: " Err desc: Type must be a type provided by the
runtime, not a TypeDelegator, etc.
Parameter name: type"
or invalidCastException and the following wierd
message: "Can not cast from Namespace.ClassName to
Namespace.ClassName type"

1) This code is run from class within same dll as the
classes it try to instanciate at run time(but for differnt
classes).
2) The dll is a com+ and registered in the gac(called by
other app as well)
3)From external projects, of any kind, the exception is
not thrown.

Any help?, may be use load method is better (I cant do it
just by string, don't know why either).


.


1 Answer

Bill Evans \(MS\)

12/11/2002 11:38:00 PM

0

Can I get a little more information?

- What is the full path of the dll? Specifically, is that the path to the
dll in the GAC?
- I don't know what you mean by "within same dll as the classes it try to
instanciate at run time". Can you elaborate?
- Can you provide a very simple repro? I can't cause the failure that you
are reporting, but I'm probably not doing exactly what you are trying to do.

Thanks,

Bill Evans [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.

"nay" <nay42212001@yahoo.com> wrote in message
news:01a601c2a026$52c79c50$cef82ecf@TK2MSFTNGXA08...
> Hi!
> I try to run the following code:
>
> assem = System.Reflection.Assembly.LoadFrom("Full Path of
> dll")
> classType = assem.GetType("Namespace.ClassName")
> obj = Activator.CreateInstance(classType, True)
>
> 2 kinds of exception message are thrown from The last
> line: ArgumentException, and the
> message: " Err desc: Type must be a type provided by the
> runtime, not a TypeDelegator, etc.
> Parameter name: type"
> or invalidCastException and the following wierd
> message: "Can not cast from Namespace.ClassName to
> Namespace.ClassName type"
>
> 1) This code is run from class within same dll as the
> classes it try to instanciate at run time(but for differnt
> classes).
> 2) The dll is a com+ and registered in the gac(called by
> other app as well)
> 3)From external projects, of any kind, the exception is
> not thrown.
>
> Any help?, may be use load method is better (I cant do it
> just by string, don't know why either).
>
>
> .
>
>