Debugging is actually quite hard in a release environment. I have learned a great deal about how to do this by reading the following blogs:
Mike Taulty has three good blogs:
Part 1, Part 2 and Part 3
Tess Ferrandez has the ultimate blog for debugging managed apps
John Robbins rates Tess above himself
Thursday, June 29, 2006
Wednesday, June 28, 2006
TLA decoder
Occasionally I come across a TLA and have no idea what it means - by chance I found a web site which has some pretty good suggestions:
http://www.acronymfinder.com/
http://www.acronymfinder.com/
Wednesday, June 21, 2006
500 GHz anyone??
If you have access to some sophisticated cooling equipment (I was tempted to say cool equipment but thought better of it) and some non silicon material then it's possible to increase the processing speed to 500 GHz
Tuesday, June 20, 2006
Immediate window + System.IO.File.WriteAllText()
I'm sure I'm probably the last person to have thought of this....
With the new System.IO.File.WriteAllText() method in v2.0, it's ultra easy to walk up to an object in the immediate windows of VS 2005 and empty it into a file of your choice...as an example, you can easily type the following into the immediate window:
//assuming nameofthevariable is in scope of course...
System.IO.File.WriteAllText("c:\\temp\\somedata.txt", nameofthevariable.ToString())
BTW, in case you didn't know already, you don't need the semi colon at the end of the statement in the immediate window
With the new System.IO.File.WriteAllText() method in v2.0, it's ultra easy to walk up to an object in the immediate windows of VS 2005 and empty it into a file of your choice...as an example, you can easily type the following into the immediate window:
//assuming nameofthevariable is in scope of course...
System.IO.File.WriteAllText("c:\\temp\\somedata.txt", nameofthevariable.ToString())
BTW, in case you didn't know already, you don't need the semi colon at the end of the statement in the immediate window
Friday, June 16, 2006
Change in v2.0 Delegate.GetHashCode()
There has been a subtle but interesting change to the implementation of Delegate.GetHashCode() in v2.0
Previously it was a function of the method pointer value in v1.x:
public override int GetHashCode() {
if (this.IsStatic()) {
return this._methodPtrAux.ToInt32();
}
return this._methodPtr.ToInt32();
}
This has totally changed with v2.0 - instead they now (scuse the pun) delegate the call to the System.Type for the delegate type:
public override int GetHashCode() {
return base.GetType().GetHashCode();
}
Of course, it's totally fine that two different objects produce the same hashcode when added into the same hashtable. It just means the lookup algorithm will take a little longer.
Compiling the code below [1] under v1.x and v2.0 will highlight the change. Under v1.x the code produces this output:
10244731 == 10244747
bob
steve
under v2.0 it produces this output:
2031146524 == 2031146524
bob
steve
[1]
using System;
using System.Collections;
class app {
static void Func1(object sender, EventArgs args) { Console.WriteLine("hi"); }
static void Func2(object sender, EventArgs args) { }
static void Main() {
EventHandler eh1 = new EventHandler(Func1);
EventHandler eh2 = new EventHandler(Func2);
//output is different on v1.x but same on v2.0
Console.WriteLine("{0} == {1}", eh1.GetHashCode(),
eh2.GetHashCode());
Hashtable dict = new Hashtable();
dict.Add(eh1, "bob");
dict.Add(eh2, "steve");
Console.WriteLine(dict[eh1]); //output is: bob
Console.WriteLine(dict[eh2]); //output is: steve
}
}
Previously it was a function of the method pointer value in v1.x:
public override int GetHashCode() {
if (this.IsStatic()) {
return this._methodPtrAux.ToInt32();
}
return this._methodPtr.ToInt32();
}
This has totally changed with v2.0 - instead they now (scuse the pun) delegate the call to the System.Type for the delegate type:
public override int GetHashCode() {
return base.GetType().GetHashCode();
}
Of course, it's totally fine that two different objects produce the same hashcode when added into the same hashtable. It just means the lookup algorithm will take a little longer.
Compiling the code below [1] under v1.x and v2.0 will highlight the change. Under v1.x the code produces this output:
10244731 == 10244747
bob
steve
under v2.0 it produces this output:
2031146524 == 2031146524
bob
steve
[1]
using System;
using System.Collections;
class app {
static void Func1(object sender, EventArgs args) { Console.WriteLine("hi"); }
static void Func2(object sender, EventArgs args) { }
static void Main() {
EventHandler eh1 = new EventHandler(Func1);
EventHandler eh2 = new EventHandler(Func2);
//output is different on v1.x but same on v2.0
Console.WriteLine("{0} == {1}", eh1.GetHashCode(),
eh2.GetHashCode());
Hashtable dict = new Hashtable();
dict.Add(eh1, "bob");
dict.Add(eh2, "steve");
Console.WriteLine(dict[eh1]); //output is: bob
Console.WriteLine(dict[eh2]); //output is: steve
}
}
Thursday, June 15, 2006
Subscribe to:
Posts (Atom)