473,722 Members | 2,240 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Exception has been thrown by the target of an invocation."

Hi, I have a problem when loading one of my dll. I have a main class that
would load a winform in another dll using reflection. When I load it using
Assembly.Create Instance(DLLNam e.DLLFormName), an exception is thrown with the
message: "Exception has been thrown by the target of an invocation."

?ex.Source
"mscorlib"

?ex.GetType.Ass emblyQualifiedN ame
"System.Reflect ion.TargetInvoc ationException, mscorlib, Version=1.0.500 0.0,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9"

?ex.StackTrace
" at System.RuntimeT ype.CreateInsta nceImpl(Boolean publicOnly)
at System.Activato r.CreateInstanc e(Type type, Boolean nonPublic)
at System.RuntimeT ype.CreateInsta nceImpl(Binding Flags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttri butes)
at System.Activato r.CreateInstanc e(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttri butes)
at System.Reflecti on.Assembly.Cre ateInstance(Str ing typeName, Boolean
ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args,
CultureInfo culture, Object[] activationAttri butes)
at System.Reflecti on.Assembly.Cre ateInstance(Str ing typeName)
at ..."

?ex.GetBaseExce ption
{System.Compone ntModel.Win32Ex ception}
[System.Componen tModel.Win32Exc eption]:
{System.Compone ntModel.Win32Ex ception}
HelpLink: Nothing
InnerException: Nothing
Message: "Not enough storage is available to process this command"
Source: "System.Drawing "
StackTrace: " at System.Drawing. Icon.Initialize (Int32 width, Int32
height)
at System.Drawing. Icon..ctor(Seri alizationInfo info, StreamingContex t
context)"
TargetSite: {System.Reflect ion.RuntimeMeth odInfo}

As from ex.GetBaseExcep tion, I found that it states there is no enough
storage. When I try to remove some code operation (that retrieve lots of
information, create classes, and display in a listview), I no longer have the
problem and the dll/form loads properly. So, is this really that it is a
memory problem and that memory is running low? How can I fix this if I must
have those removed code to run? How does .net actually allocates the memory?
Is it that the memory of the whole computer has been used up, or is that
there is a limited allocation for my program? Would by increasing the virtual
memory, or let it autogrow helps?

Thanks
Eugene

Jun 14 '06 #1
2 45456
Anybody, any idea?

"Eugene" wrote:
Hi, I have a problem when loading one of my dll. I have a main class that
would load a winform in another dll using reflection. When I load it using
Assembly.Create Instance(DLLNam e.DLLFormName), an exception is thrown with the
message: "Exception has been thrown by the target of an invocation."

?ex.Source
"mscorlib"

?ex.GetType.Ass emblyQualifiedN ame
"System.Reflect ion.TargetInvoc ationException, mscorlib, Version=1.0.500 0.0,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9"

?ex.StackTrace
" at System.RuntimeT ype.CreateInsta nceImpl(Boolean publicOnly)
at System.Activato r.CreateInstanc e(Type type, Boolean nonPublic)
at System.RuntimeT ype.CreateInsta nceImpl(Binding Flags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttri butes)
at System.Activato r.CreateInstanc e(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttri butes)
at System.Reflecti on.Assembly.Cre ateInstance(Str ing typeName, Boolean
ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args,
CultureInfo culture, Object[] activationAttri butes)
at System.Reflecti on.Assembly.Cre ateInstance(Str ing typeName)
at ..."

?ex.GetBaseExce ption
{System.Compone ntModel.Win32Ex ception}
[System.Componen tModel.Win32Exc eption]:
{System.Compone ntModel.Win32Ex ception}
HelpLink: Nothing
InnerException: Nothing
Message: "Not enough storage is available to process this command"
Source: "System.Drawing "
StackTrace: " at System.Drawing. Icon.Initialize (Int32 width, Int32
height)
at System.Drawing. Icon..ctor(Seri alizationInfo info, StreamingContex t
context)"
TargetSite: {System.Reflect ion.RuntimeMeth odInfo}

As from ex.GetBaseExcep tion, I found that it states there is no enough
storage. When I try to remove some code operation (that retrieve lots of
information, create classes, and display in a listview), I no longer have the
problem and the dll/form loads properly. So, is this really that it is a
memory problem and that memory is running low? How can I fix this if I must
have those removed code to run? How does .net actually allocates the memory?
Is it that the memory of the whole computer has been used up, or is that
there is a limited allocation for my program? Would by increasing the virtual
memory, or let it autogrow helps?

Thanks
Eugene

Jun 15 '06 #2
My guess would be that at the times it blows-up, you are passing bad
values for the icon's height & width (ie, it thinks you want it to
create an massive icon).

When you moved things around, you stoped corrupting these values.
Eugene wrote:
Hi, I have a problem when loading one of my dll. I have a main class that
would load a winform in another dll using reflection. When I load it using
Assembly.Create Instance(DLLNam e.DLLFormName), an exception is thrown with the
message: "Exception has been thrown by the target of an invocation."

?ex.Source
"mscorlib"

?ex.GetType.Ass emblyQualifiedN ame
"System.Reflect ion.TargetInvoc ationException, mscorlib, Version=1.0.500 0.0,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9"

?ex.StackTrace
" at System.RuntimeT ype.CreateInsta nceImpl(Boolean publicOnly)
at System.Activato r.CreateInstanc e(Type type, Boolean nonPublic)
at System.RuntimeT ype.CreateInsta nceImpl(Binding Flags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttri butes)
at System.Activato r.CreateInstanc e(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttri butes)
at System.Reflecti on.Assembly.Cre ateInstance(Str ing typeName, Boolean
ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args,
CultureInfo culture, Object[] activationAttri butes)
at System.Reflecti on.Assembly.Cre ateInstance(Str ing typeName)
at ..."

?ex.GetBaseExce ption
{System.Compone ntModel.Win32Ex ception}
[System.Componen tModel.Win32Exc eption]:
{System.Compone ntModel.Win32Ex ception}
HelpLink: Nothing
InnerException: Nothing
Message: "Not enough storage is available to process this command"
Source: "System.Drawing "
StackTrace: " at System.Drawing. Icon.Initialize (Int32 width, Int32
height)
at System.Drawing. Icon..ctor(Seri alizationInfo info, StreamingContex t
context)"
TargetSite: {System.Reflect ion.RuntimeMeth odInfo}

As from ex.GetBaseExcep tion, I found that it states there is no enough
storage. When I try to remove some code operation (that retrieve lots of
information, create classes, and display in a listview), I no longer have the
problem and the dll/form loads properly. So, is this really that it is a
memory problem and that memory is running low? How can I fix this if I must
have those removed code to run? How does .net actually allocates the memory?
Is it that the memory of the whole computer has been used up, or is that
there is a limited allocation for my program? Would by increasing the virtual
memory, or let it autogrow helps?

Thanks
Eugene


Jun 15 '06 #3

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

Similar topics

3
6218
by: Noah | last post by:
How does Image.putdata() work? I am using PIL 1.1.3. This simple script throws an exception on putdata(): import Image width = 10 height = 10 im = Image.new ("RGB", (width, height)) L = list(im.getdata()) k = 0 for y in range (height):
0
1586
by: Lionel B | last post by:
Greetings, Using gcc (GCC) 3.3.3 (cygwin special) on Win2K Does anyone know if there is a convenient mechanism to cause a C++ exception to be thrown whenever a IEEE 754 floating-point "exception" is raised? Currently I a check the FPU status word wherever I wish to test for FP errors and throw a C++ exception accordingly. This is fine; but
2
15503
by: hazz | last post by:
I have spent more time than I care to admit trying to track down a very subtle error. Here is my app's xx.exe.config file. <?xml version="1.0" encoding="utf-8" ?> <configuration> <appsettings> <add key="PasswordProvider" value="fudge" /> </appsettings>
7
12030
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 a token into the instantiated class DBPassword and return a string; ************************************** namespace DBPasswordProvider public class DBPassword {
6
1675
by: Chris Newcombe | last post by:
Please could someone on the VC++ 7.0 compiler team (note; not 7.1) tell me if this code is handled 'correctly' (i.e. as the original poster suggests) in all cases? http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=89ed5u%248ck%40library1.airnews.net (Incase the URL doesn't make it I've copied it below.) I have a situation where I really need this technique. But the fact that Dave Abrahams wasn't sure about it very much worries...
4
22480
by: Carlitos | last post by:
Hi there, I got a web application in vb.net that uploads a .zip file to a subfolder inside the root folder of the web application. c:\Inetpub\wwwroot\MyWebApp\uploaddir Then, a c# library unzips it inside another subfolder inside the subfolder where the .zip was uploaded.
2
3091
by: Fabian | last post by:
Hi, I work with asp.net 2.0 and I have a intermittent error, only happens a few times a day. In the page I evaluate a Query String and then I get data form a database. The code snipped: try {
2
4240
by: cmay | last post by:
I have changed my config files to set the limit for files being uploaded to 30 MB, but every now and then someone tries to upload a file larger than this. All I want, is to be able to trap the error and tell the user what happened. I can trap the error in the page_error (Page.Error) event, and I believe I was also trapping it at the application_error level at one point. My problem is, once I trap the error, I can't do anything to tell...
2
3691
by: Monty | last post by:
I have a GridView in an update panel, and the GridView has an ObjectDataSource. Under certain conditions the Object that is the ObjectDataSource will throw an exception with a specific error message, but on the client side the only error message displayed is "exception has been thrown by the target of an invocation". I would like the error message on the client to show the error description the object provides when it throws the error. Is...
0
8739
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,...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9088
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
8052
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
6681
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
5995
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();...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2147
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.