By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,079 Members | 1,788 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,079 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.CreateInstance(DLLName.DLLFormName), an exception is thrown with the
message: "Exception has been thrown by the target of an invocation."

?ex.Source
"mscorlib"

?ex.GetType.AssemblyQualifiedName
"System.Reflection.TargetInvocationException, mscorlib, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"

?ex.StackTrace
" at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.Reflection.Assembly.CreateInstance(String typeName, Boolean
ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args,
CultureInfo culture, Object[] activationAttributes)
at System.Reflection.Assembly.CreateInstance(String typeName)
at ..."

?ex.GetBaseException
{System.ComponentModel.Win32Exception}
[System.ComponentModel.Win32Exception]:
{System.ComponentModel.Win32Exception}
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(SerializationInfo info, StreamingContext
context)"
TargetSite: {System.Reflection.RuntimeMethodInfo}

As from ex.GetBaseException, 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
Share this Question
Share on Google+
2 Replies


P: n/a
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.CreateInstance(DLLName.DLLFormName), an exception is thrown with the
message: "Exception has been thrown by the target of an invocation."

?ex.Source
"mscorlib"

?ex.GetType.AssemblyQualifiedName
"System.Reflection.TargetInvocationException, mscorlib, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"

?ex.StackTrace
" at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.Reflection.Assembly.CreateInstance(String typeName, Boolean
ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args,
CultureInfo culture, Object[] activationAttributes)
at System.Reflection.Assembly.CreateInstance(String typeName)
at ..."

?ex.GetBaseException
{System.ComponentModel.Win32Exception}
[System.ComponentModel.Win32Exception]:
{System.ComponentModel.Win32Exception}
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(SerializationInfo info, StreamingContext
context)"
TargetSite: {System.Reflection.RuntimeMethodInfo}

As from ex.GetBaseException, 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

P: n/a
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.CreateInstance(DLLName.DLLFormName), an exception is thrown with the
message: "Exception has been thrown by the target of an invocation."

?ex.Source
"mscorlib"

?ex.GetType.AssemblyQualifiedName
"System.Reflection.TargetInvocationException, mscorlib, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"

?ex.StackTrace
" at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.Reflection.Assembly.CreateInstance(String typeName, Boolean
ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args,
CultureInfo culture, Object[] activationAttributes)
at System.Reflection.Assembly.CreateInstance(String typeName)
at ..."

?ex.GetBaseException
{System.ComponentModel.Win32Exception}
[System.ComponentModel.Win32Exception]:
{System.ComponentModel.Win32Exception}
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(SerializationInfo info, StreamingContext
context)"
TargetSite: {System.Reflection.RuntimeMethodInfo}

As from ex.GetBaseException, 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 discussion thread is closed

Replies have been disabled for this discussion.