473,809 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Type.GetType not finding the dll containing the method I want to use in a late bound context.

"Value cannot be null.\r\nParame ter name: type" is the exception thrown
after the CreateInstance method below.

Type t = Type.GetType(Ge tConfigValue("P asswordProvider "));
IPasswordProvid er ppdr= (IPasswordProvi der)Activator.C reateInstance(t );

GetConfigValue DOES return the correct value from the config file -
"namespace.DBPa ssword, namespace"

It appears that Type.GetType is NOT finding the assembly whose name is the
same as the namespace above (DBPassword is the name of the class contained
within that assembly/dll.

In the remarks section for Type.GetType I read the following;

If the assembly has not been saved to disk when GetType is called, the
method returns a null reference . GetType does not understand transient
dynamic assemblies; therefore, calling GetType to retrieve a type in a
transient dynamic assembly returns a null reference (Nothing).

I can see that the dll DOES exist in the /bin/debug directory with a recent
timestamp. I would assume it has already been saved to disk when the search
is made for it.

Any ideas on how to troubleshoot this?

Thank you,
Greg
Nov 16 '05 #1
1 3222
Greg,

You should load the assembly first, through a call to the Load method on
the Assembly class (make sure to use the full assembly name). Fusion
*should* pick it up if it is in the bin directory.

Once you have that, you can call CreateInstance on the Assembly instance
returned, passing the full type name.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"hazz" <ha**@sonic.net > wrote in message
news:ez******** ********@TK2MSF TNGP11.phx.gbl. ..
"Value cannot be null.\r\nParame ter name: type" is the exception thrown
after the CreateInstance method below.

Type t = Type.GetType(Ge tConfigValue("P asswordProvider "));
IPasswordProvid er ppdr= (IPasswordProvi der)Activator.C reateInstance(t );

GetConfigValue DOES return the correct value from the config file -
"namespace.DBPa ssword, namespace"

It appears that Type.GetType is NOT finding the assembly whose name is the
same as the namespace above (DBPassword is the name of the class contained
within that assembly/dll.

In the remarks section for Type.GetType I read the following;

If the assembly has not been saved to disk when GetType is called, the
method returns a null reference . GetType does not understand transient
dynamic assemblies; therefore, calling GetType to retrieve a type in a
transient dynamic assembly returns a null reference (Nothing).

I can see that the dll DOES exist in the /bin/debug directory with a recent timestamp. I would assume it has already been saved to disk when the search is made for it.

Any ideas on how to troubleshoot this?

Thank you,
Greg

Nov 16 '05 #2

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

Similar topics

7
465
by: Siggy | last post by:
How can I trap this error -User-defined type not defined - in order to make custom error messages, when there is a missing reference, or missing dll/ocx file. Siggy
6
19213
by: Jim Bancroft | last post by:
Hi everyone, I'm having some trouble with the code below. I receive a compile-time error on the second line saying "; expected": private static void myTestFunction(long myLong) { System.Data.SqlTypes.SqlInt32 myTestInt;
7
10011
by: Clint Herron | last post by:
Howdy! I posted this question on CSharpCorner.com, but then realized I should probably post it on a more active newsgroup. This will be my only cross-post. I'm creating a game engine, and using CodeDOM for my scripting needs (I realize I could use yacc or something else, but I wanted to try using CodeDOM -- this is more of an exercise for me to learn this stuff). Well, I compile my in-game scripts just fine. See appendix A for my code
4
2564
by: Chris Bower | last post by:
Reposted from aspnet.buildingcontrols: Ok, I've got a bunch of derived controls that all have a property Rights of type Rights (Rights is an Enumerator). I wrote a custom TypeConverter so that I can use comma separated values in design-time. The TypeConverter works great in design-time. It converts to and from just fine... However, when I try to load any page in the site now I get the following error (Following the error is code for the...
16
1919
by: Dennis | last post by:
I have a class named "myclass" and an arraylist containing elements of type "MyClass". I want to get the value of a property of "MyClass" (a string type) for one of the arraylist elements. I can get this using: dim b as string b = DirectCast(myarraylist(0),myclass).myproperty However, I want to use an object to define the type "MyClass" like: dim C as type = type.GetType(myarraylist(0))
11
3569
by: JohnR | last post by:
I'm trying to find a way to create a variable of a given type at runtime where I won't know the type until it actually executes. For example, dim x as object = "hi" x is declared as an object but x.gettype returns 'string', so it knows it contains a string. If I want to create a variable "y" as the same type that variable x contains how would I do that without having to iterate thru every possible
7
11964
by: Martin Robins | last post by:
I am currently looking to be able to read information from Active Directory into a data warehouse using a C# solution. I have been able to access the active directory, and I have been able to return "DirectoryEntry" objects within the path that I specify (either using the DirectoryEnrtry.Children or using the DirectorySearcher class) and all started well and dandy! Now the problem; some of the properties of the DirectoryEntry objects being...
0
1684
by: CrispinH | last post by:
Hi I've just upgraded some Type Editors from 1.1 to 2.0 and whilst they compile OK, I'm not getting any results in the test harness PropertyGrid. Usually when you select a particular property, the ellipsis appears at the end of the cell and this is not heppening. I was therefore wondering if there had been changes in TypeEditors between ..NET versions 1.1 and 2.0 that I hadn't hear about.
1
7118
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that someone who bothers to read all of it have some pointers. Note, I have posted the stack trace and the code exhibiting the problem further down so if you want to start by reading that, search for +++ Also note that I am unable to reproduce...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10378
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.