Greetings!
I am mystified by type converters. At design time, I enter a string into a
text field. At run time, I query the field, and the string I entered isn't
there. Also, I derived my converter from the ExpandableObjectConverter, and
my converter is getting called once for each property my class has, instead
of just once.
To start, I would like to step through my converter, but it doesn't seem
possible to invoke the debugger when you're working at design time. Is it
possible to use the debugger to step through a custom converter?
Thanks!
Rob Richardson
Frank Hileman - 15 Oct 2004 23:15 GMT
Configure your project to launch another instance of devenv.exe in the
debugger. On the command line pass the name of a test project using your
converter.
Regards,
Frank Hileman
check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor
> Greetings!
>
[quoted text clipped - 11 lines]
>
> Rob Richardson
Joey Callisay - 19 Oct 2004 02:20 GMT
I observed that most people prefer reconfiguring VS to launch another
instance of devenv to debug the current project (which is what most
documentations tell us). I prefer attaching another instance to the
devenv.exe process to be debugged.
> Configure your project to launch another instance of devenv.exe in the
> debugger. On the command line pass the name of a test project using your
[quoted text clipped - 26 lines]
> >
> > Rob Richardson
Ulrich Sprick - 13 Dec 2004 18:54 GMT
Hi Rob,
most type converter methods can be debugged if you drop a PropertyGrid on a
form, and set the SelectedObject to an instance of your component. This way
you can easily debug the conversion methods, and GetProperties() should also
be no problem.
A problem is the serialization, wich is called by the design-time
environment (e.g. Windows Forms designer). To debug it, you need a 2nd VS
instance and debug the other one.
However, there is another simple solution to test your serialization code:
From a test program, call your type converters CanConvertTo() and
ConvertTo() methods for the type InstanceDescriptor.
ConvertTo() should return an instance descriptor, that can be used to create
a new object of your target type from code:
TargetType value = new TargetType(...);
...
InstanceDescriptor id = typeconverter.ConvertTo( context, culture,
value, typeof( InstanceDescriptor ));
TargetType value2 = (TargetType) id.Invoke();
If value2 is initialized correctly, then you are on the right track.
HTH,
ulrich.
> Greetings!
>
[quoted text clipped - 11 lines]
>
> Rob Richardson