PC Review


Reply
Thread Tools Rate Thread

Assembly.CreateInstance returns null?

 
 
Rick Lemons
Guest
Posts: n/a
 
      18th May 2005
Can anyone tell me what's wrong with the following CreateInstance? It
returns null. The Assembly.LoadFrom works OK.

Assembly assembly = Assembly.LoadFrom("MyDll.dll");
object functionObject = assembly.CreateInstance("MyNamespace.MyClass");

MyDll looks like:

namespace MyNamespace
{
public class MyClass
{
public MyClass()
{
}
}
}



Thank you.


 
Reply With Quote
 
 
 
 
Carlos J. Quintero [.NET MVP]
Guest
Posts: n/a
 
      19th May 2005
If works fine on my side. I'd suggest to use assembly.GetExportedTypes to
list the exported types of MyDll.dll.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Rick Lemons" <(E-Mail Removed)> escribió en el mensaje
news:(E-Mail Removed)...
> Can anyone tell me what's wrong with the following CreateInstance? It
> returns null. The Assembly.LoadFrom works OK.
>
> Assembly assembly = Assembly.LoadFrom("MyDll.dll");
> object functionObject = assembly.CreateInstance("MyNamespace.MyClass");
>
> MyDll looks like:
>
> namespace MyNamespace
> {
> public class MyClass
> {
> public MyClass()
> {
> }
> }
> }
>
>
>
> Thank you.
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference Between assembly.CreateInstance and System.Activator.CreateInstance John Jenkins Microsoft C# .NET 1 14th Oct 2004 10:00 PM
Cannot CreateInstance of Assembly after loading it with Assembly.Load(byte[]) Dmitriy Krasnikov Microsoft Dot NET Framework 3 11th May 2004 07:45 PM
Using Assembly.CreateInstance on assembly created with ConvertTypeLibToAssembly Scott James Microsoft Dot NET Framework 1 24th Mar 2004 08:45 AM
GetType returns null on a loaded assembly Zoury Microsoft C# .NET 3 22nd Oct 2003 11:07 PM
Re: Assembly.CreateInstance returns null Gabriele G. Ponti Microsoft Dot NET Framework 0 14th Jul 2003 02:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:12 PM.