31. May 2006 15:47
By
ckramer
In
I just learned that Microsoft changed the way unhandled exceptions in Threads are propogated in .Net 2.0 vs the way they worked in 1.1. With 2.0 any unhandled exceptions in a thread will not only cause that thread to exit, but will also be bubbled up to the thread that started the offending thread. Overall, I think this is a good thing, since not only will it force people to handle exceptions within their thread code, but it will also eliminate the problem of processes mysteriously stopping if there is an unhandled exception on a thread. It will, however, cause some serious grief for any developers not expecting that sort of behavior. I'm sure I'm not the only one who has seen less than steller multi-threaded programming tactics in applications which should be better behaived (heck, I've done my share of shoddy thread handling in the past).
The one exception to this, of course, is the ThreadAbortException, which understandably, only effects the thread it is raised on. Granted using Thread.Abort, or raising a ThreadAbortException is considered a brute-force approach, so it shouldn't be happening anyway....
2132b04e-ff4c-4e62-9d3b-6698414dbb0d|0|.0
Tags:
24. May 2006 16:30
By
ckramer
In
It just goes to show that there are always little surprises waiting around the corner. I've been looking at least casually at .Net 2.0 since Beta 2, and I even read through the "What's New" for C# 2.0 to see if I missed anything. Somehow I managed not to notice Implicit Delegate Assignment (or at least that's what I'm calling it).
It is now possible to assign a delegate using just the Class and Method name...you no longer have to create a new instance of the delegate type. Not a huge thing, I know, but for those of us who are easily impressed it's, well, impressive.
Here's the skinny in code language:
public class SomeClass
{
public event EventHandler MyEvent;
}
public class SomeOtherClass
{
SomeClass _class;
public SomeOtherClass()
{
_class = new SomeClass();
// Old Way
_class.MyEvent += new EventHandler(this.MyHandler);
// New Way
_class.MyEvent += this.MyHandler;
}
public void EventHandler(object sender, EventArgs args)
{
// Handler Code
}
}
769db215-45d6-44f3-b64c-2f2c408356d2|0|.0
Tags:
10. May 2006 17:32
By
ckramer
In
The Dr. is back....after a few years away, I've now decided to make DrRandom.org a blog...come back for more.
7e4c39b9-568b-4399-8399-21e653e2b799|0|.0
Tags: