I have continued with development that has unfortunately changed the symptom
a bit. This may be easier to diagnose now... as before, this is a
propertygrid that is filled with dynamically generated property descriptors,
some of which are these enumerated types. When the class declaring the enums
is in the same assembly as the property grid control it all works fine, when
i move the enums declaration to my 'objects' assembly where i would like to
have my generic objects and definitions i get black boxes in the property
grid where there should be enum lists. i now have to manually enable
breaking when exceptions are thrown to catch the exception since something is
catching it normally. it now breaks on my line:
e.Value = Enum.Parse(Type.GetType(type), stringvalue);
which is in the function that is getting the value to put in the property
grid. 'type' is the name of the type which is correct, and stringvalue is
one of the values in the enum... as i said this works when the enum is in the
same assembly as this code. what is interesting is other uses of the enums
don't throw error in this function, for instance this line doesn't throw an
error and returns a proper value:
e.Value = (eCkt)Enum.Parse(typeof(eCkt), stringvalue);
the exception:
System.ArgumentNullException occurred
Message="Value cannot be null.\r\nParameter name: enumType"
Source="mscorlib"
ParamName="enumType"
StackTrace:
at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
InnerException:
the stack:
mscorlib.dll!System.Enum.Parse(System.Type enumType, string value, bool
ignoreCase) + 0x2c3 bytes
mscorlib.dll!System.Enum.Parse(System.Type enumType, string value) + 0x7
bytes
TERA.Controls.dll!TERA.Controls.Tree.TERATreeView.propertyBag_GetValue(object sender = {TERA.Controls.Tree.PropertyBag}, TERA.Controls.Tree.PropertySpecEventArgs e = {TERA.Controls.Tree.PropertySpecEventArgs}) Line 67 + 0x36 bytes C#
TERA.Controls.dll!TERA.Controls.Tree.PropertyBag.OnGetValue(TERA.Controls.Tree.PropertySpecEventArgs
e = {TERA.Controls.Tree.PropertySpecEventArgs}) Line 872 + 0x1a bytes C#
TERA.Controls.dll!TERA.Controls.Tree.PropertyBag.PropertySpecDescriptor.GetValue(object
component = {TERA.Controls.Tree.PropertyBag}) Line 796 + 0xe bytes C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.GetPropEntries(System.Windows.Forms.PropertyGridInternal.GridEntry
peParent =
{System.Windows.Forms.PropertyGridInternal.SingleSelectRootGridEntry
TERA.Controls.Tree.PropertyBag}, object obj =
{TERA.Controls.Tree.PropertyBag}, System.Type objType) + 0x38c bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.CreateChildren(bool diffOldChildren = false) + 0xc6 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.SingleSelectRootGridEntry.CreateChildren() + 0x13 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.InternalExpanded.set(bool value) + 0x79 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.SingleSelectRootGridEntry.SingleSelectRootGridEntry(System.Windows.Forms.PropertyGridInternal.PropertyGridView
gridEntryHost, object value,
System.Windows.Forms.PropertyGridInternal.GridEntry parent,
System.IServiceProvider baseProvider,
System.ComponentModel.Design.IDesignerHost host,
System.Windows.Forms.Design.PropertyTab tab,
System.Windows.Forms.PropertySort sortType) + 0x86 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.Create(System.Windows.Forms.PropertyGridInternal.PropertyGridView
view, object[] rgobjs, System.IServiceProvider baseProvider,
System.ComponentModel.Design.IDesignerHost currentHost,
System.Windows.Forms.Design.PropertyTab tab,
System.Windows.Forms.PropertySort initialSortType) + 0x69 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.UpdateSelection()
+ 0x14a bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.RefreshProperties(bool clearCached) + 0x92 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.Refresh(bool
clearCached) + 0x6d bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.SelectedObjects.set(object[] value) + 0x92e bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGrid.SelectedObject.set(object value) + 0x4d bytes
TERA.Controls.dll!TERA.Controls.Tree.TERATreeView.OnMouseUp(System.Windows.Forms.MouseEventArgs
e = {X = 154 Y = 300 Button = Left}) Line 1081 + 0x2d bytes C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref
System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int
clicks) + 0x28f bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref
System.Windows.Forms.Message m) + 0x885 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x10 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr
hWnd, int msg = 514, System.IntPtr wparam, System.IntPtr lparam) + 0x57 bytes
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason = -1, int pvLoopData = 0) + 0x24e bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int
reason = -1, System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext}) + 0x177 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int
reason, System.Windows.Forms.ApplicationContext context) + 0x61 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) + 0x31 bytes
TERAApp.exe!TERAApp.Program.Main() Line 17 + 0x1d bytes C#
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile,
System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x3a bytes
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2b bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object
state) + 0x66 bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext
executionContext, System.Threading.ContextCallback callback, object state) +
0x6f bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes
-----------------------------------------------------------------------------------------------
Note, i can still get the argumentnullexception in getdescriptor if i click
on one of the black boxes in the property grid, that does crash the app with
System.dll!System.ComponentModel.TypeDescriptor.GetDescriptor(System.Type type, string typeName = "type") Line 1555 C#
System.dll!System.ComponentModel.TypeDescriptor.GetConverter(System.Type
type) Line 1468 + 0x10 bytes C#
System.dll!System.ComponentModel.PropertyDescriptor.Converter.get() Line
100 + 0x14 bytes C#
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry.TypeConverter.get() + 0x20 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.GetPropertyTextValue(object value = Shield) + 0x2f bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.GetPropertyTextValue() + 0x1c bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.SelectRow(int row = 3) + 0x18d bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.SelectGridEntry(System.Windows.Forms.PropertyGridInternal.GridEntry
gridEntry, bool fPageIn) + 0xb8 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnGridEntryValueClick(object s, System.EventArgs e) + 0x64 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.RaiseEvent(object key, System.EventArgs e) + 0x41 bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.OnValueClick(System.EventArgs e) + 0x2a bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.OnMouseClick(int
x, int y, int count, System.Windows.Forms.MouseButtons button) + 0x18f bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry.OnMouseClick(int
x, int y, int count, System.Windows.Forms.MouseButtons button) + 0xdf bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnMouseDown(System.Windows.Forms.MouseEventArgs me) + 0x15b bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseDown(ref
System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int
clicks) + 0xcf bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref
System.Windows.Forms.Message m) + 0x86e bytes
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.WndProc(ref System.Windows.Forms.Message m) + 0x20b bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x10 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr
hWnd, int msg = 513, System.IntPtr wparam, System.IntPtr lparam) + 0x57 bytes
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason = -1, int pvLoopData = 0) + 0x24e bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int
reason = -1, System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext}) + 0x177 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int
reason, System.Windows.Forms.ApplicationContext context) + 0x61 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) + 0x31 bytes
TERAApp.exe!TERAApp.Program.Main() Line 17 + 0x1d bytes C#
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile,
System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x3a bytes
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2b bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object
state) + 0x66 bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext
executionContext, System.Threading.ContextCallback callback, object state) +
0x6f bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes
Hi Dave,
The GetDescriptor method is an internal method of the TypeDescriptor class.
One of its overloads takes a Type and a String as its parameters. If the
Type parameter is null, it will throw an ArgumentNullException.
So now we need to find out who called this method and passed in null. It
could be any of the Get* public methods of the TypeDescriptor class.
Did you got this exception at design time or runtime?
Could you show me the call stack of the exception so we can narrow down the
cause of the problem?
Thanks,
Jie Wang
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.