473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Activator.CreateInstance Error

When I am trying to create an instance by a type object
(see in the code below)
I get the Exception:

An unhandled exception of type 'System.ArgumentException'
occurred in mscorlib.dll

Additional information: Type must be a type provided by
the runtime, not a TypeDelegator, etc.

CODE:
-----
assem = Assembly.LoadFrom
("D:\\Projects_CS#\\ClassSql\\bin\\Debug\\ClassSql .dll");
aType = assem.GetType("ClassLibSqlTest." + sType);
obj = Activator.CreateInstance(aType);

NOTE:
-----
1. The ClassSql.dll is rgeistered in COM+ server library Type.
Nov 15 '05 #1
0 1880

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

Similar topics

2
by: shmeian | last post by:
I have the following code which works fine. However I want to pass the object I'm instantiating a string for its constructor. I can't get the syntax right. Can someone give me an example of...
15
by: Brian Rogers | last post by:
Hello everyone, I apologize for the cross and re-post, but I am still searching for an answer. Why can C++ can create this object, but C# can't? I am trying to create an instance of the...
7
by: hazz | last post by:
this is a repost with more concise code (well, for me) and better questions (I hope....) . given the following two classes, my intent is to use either Activator.CreateInstance or InvokeMember pass...
3
by: Doug Riley | last post by:
I am using CreateInstance to create an instance of a class and invoke a function of that class. I really need it to execute in a single line of code (long story, but I want to execute this code in...
3
by: System.Reflection Activator | last post by:
************************************** //Load the Assembly Assembly a = Assembly.LoadFrom(sAssembly); //Get Types so we can Identify the Interface. Type mytypes = a.GetTypes(); BindingFlags...
1
by: hazz | last post by:
this is a repost with a hopefully more clearly stated scenario and more concise questions at the end. given the following two classes, my intent is to use pass a token into the instantiated class...
3
by: bahadirarslan | last post by:
Hi All, I have a problem with Activator.CreateInstance method. I have got a class like this public class YaziYaz { public YaziYaz() { HttpContext.Current.Response.Write("Running");
5
by: ismail.mayat | last post by:
Hello, I am having a problem with Activator.CreateInstance. I have the following code Assembly asm = System.Reflection.Assembly.LoadFrom(assembly); if(asm!=null) { try {
1
by: Johnny R | last post by:
Hello, I'm loading a Class from Assemly DLL using Activator.CreateInstance. That loaded Class is executed in a worker Thread with no loop. What actually happends when class is loaded using...
0
by: vignesh28 | last post by:
hi .. i got the following error in activator.createinstance method 'Exception has been thrown by the target of an invocation.' this is the error. here is my code: public object...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.