Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / December 2004

Tip: Looking for answers? Try searching our database.

Can a custom converter be debugged?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob Richardson - 15 Oct 2004 20:45 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.