Some notes on software development... RSS 2.0
# Friday, 05 September 2008 have a cool article describing the unofficial Microsoft-signed dark-styled XP Theme - Royale Noir.
It looks a bit like this:



Royale Noir Download

Friday, 05 September 2008 16:46:53 (GMT Standard Time, UTC+00:00)  #    -

If an exception occurs in the BackgroundWorker control's DoWork method it will get wrapped in to the RunWorkerCompletedEventArgs object in the RunWorkerCompleted method.
Checking the Error property of the RunWorkerCompletedEventArgs tells us if an exception occurred on the BackgroundWorker's thread. By re-throwing the exception in the RunWorkerCompleted method it will then be on the calling (GUI) thread where it can be then be dealt with accordingly:

private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) throw e.Error; }
The error check should always be the first statement in the RunWorkerCompleted method.
Friday, 05 September 2008 13:10:33 (GMT Standard Time, UTC+00:00)  #    -

To stop Visual Studio 2005/2008 from loosing breakpoints and behaving erratically when debugging and using the BackgroundWorker control you need to stop the debugger from interacting with the form's thread.
greggm has a more in depth post and other solutions to the problem but for me adding the DebuggerDisplay attribute to the windows form improved debugging.

public partial class Form1 : Form


I haven't tried it but I believe you can un-check the "Call string conversion function on objects in variable windows" from the Debugging section in Visual Studio options:


Friday, 05 September 2008 11:12:45 (GMT Standard Time, UTC+00:00)  #    -
.NET | Visual Studio

Steve Tibbett has a nice blog post describing string formatting in C#.

Here are the useful bits....




Friday, 05 September 2008 10:56:52 (GMT Standard Time, UTC+00:00)  #    -

Sign In
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2019
Hadrian Phillips

All Content © 2019, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)