471,092 Members | 1,110 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

"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.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
2 45205
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
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.

Similar topics

6 posts views Thread by Chris Newcombe | last post: by

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.