Archive for the 'Not debugging related' Category

In relation with my previous post about string.GetHashCode being used in AJAXControlToolkit’s ToolkitScriptManager class, I wanted to talk about object.GetHashCode in general, and string.GetHashCode specifically.

string.GetHashCode documentation states:

“The behavior of GetHashCode is dependent on its implementation, which might change from one version of the common language runtime to another. A reason why this might happen is to improve the performance of GetHashCode.”

The real conclusion from this paragraph is that you shouldn’t base your implementation on string.GetHashCode. But this is a bit too harsh since GetHashCode in general and string.GetHashCode specifically are being used throughout the runtime for internal things.

As long as you don’t share this hash code outside the boundry of the AppDomain its relatively safe to use.

The reason you cannot (or should I say should not) pass it across an AppDomain boundry is that the basic implemenetation of object.GetHashCode is to return an integer representing the reference id of the object in the .NET runtime. That reference is not guarenteed to be the same for the same object in a different appdomain/process/machine.

In the case of string.GetHashCode, where the implementation differ from the default one, you can pass it across AppDomains and even machines (though you shouldn’t count on that as well!) as long as they are in the same architecture, i.e., 32bit to 32bit and 64bit to 64bit.

All in all, the most recommend way of using x.GetHashCode is simply not using it at all. There are numerous implementations of hashing functions built into .NET (such as MD5, SHA1, SHA256, etc) which are more consistent but may be a bit more expensive computation wise.

For all your outward facing code I would recommend using one of the common and known hashing functions specifically if this is a case where the code on the other side needs to recompute the hash and compare it with the hash value being passed.

If you mix and match 32 bit machines/processes with 64 bit machines/processes in an ASP.NET load balanced environment and you are using the AJAXControlToolkit ToolkitScriptManager class you might end up with the following error:

Message: Assembly “AjaxControlToolkit, Version=1.0.10920.32880, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e” does not contain a script with hash code “9ea3f0e2”.
Stack trace: at AjaxControlToolkit.ToolkitScriptManager.DeserializeScriptEntries(String serializedScriptEntries, Boolean loaded)

at AjaxControlToolkit.ToolkitScriptManager.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The reason is that the request being sent to retrieve the combined javascripts of the control used in the page contains a hash code that is used internally. That hash code is being generated from the script’s name using the default string.GetHashCode function which returns different values for 32 bit and 64 bit processes.

If your 64 bit process creates the javascript include call which contains the 64 bit hash code and the request will eventually reach the 32 bit process/machine you will get this error since the hash value will not be found internally and vice versa.

There is an open issue about this in CodePlex since late January but as of the time of this post, the latest source version in CodePlex doesn’t have a fix for this.

I had a couple of problems in the transfer with the feed of the new blog (http://dotnetdebug.net/feed/).

It is redirected to the Feed Burner feed and should be working OK now. The auto discovery of the feed should also work (I hope).

Please let me know if there are still problem with it.

Hey all,

Let me welcome you to the new home of Advanced .NET Debugging.

Having a new home and a new address will let me experiment a little bit more with this blog.

If you don’t already know, I have a personal blog, in which I talk about other things not related to .NET debugging (though sometimes it is related to programming and development in general).

I recently got a little bit more involved in identity online. That’s why this blog also has my MicroID WordPress plugin as well as my OpenID Delegation WordPress plugin and will allow you to authenticate yourselves with OpenID to add your comments.

These little things are important to me, being the geek that I am and I hope it will help you, me and the rest of the Internet community.

Anyhow, enjoy and don’t forget to tell your friends 😉

Forgive me for a non technical post but apparently I’ve been tagged by Tess which means I probably need to say 5 things about myself. Hmpf…

Oh well, here it goes:

  1. I can’t eat tomatoes. I can eat them in the form of ketchup and in the form of a sauce (on Italian food, for example), but I simply can’t bare the thought (or taste) of having a raw live tomato in my mouth (yuck!)
  2. I have yet to complete any formal degree from a formal institution what so ever. I’ve finished about 1/3 of a Computer Science degree in the Open University in Israel. I simply figured since I’m already rather proficient in CS I would be better off actually studying something else. I’m still considering Philosophy but haven’t had the time to make it so, mainly because I work full time and the Open University doesn’t have a Philosophy degree (perhaps its time for University 2.0, something that will actually fit people like me 🙂 ).
  3. I learned and/or playing the following musical instruments: Flute, Saxophone (soprano, alto, tenor and Baritone), Guitar (electric, classical, acoustic and bass), Piano (not enough to play Rachmaninoff, but enough to understand the basics and compose music on it), Drums (not too well, but enough to keep a steady beat)
  4. I own a Sea Kayak (an Ocean Kayak Scupper Pro) which I’ve been taking off to sea in the summer (I still haven’t gotten a dry swim suite like the divers have to actually kayak in the winter). It looks rather funny on my car’s roof (a Peugeot 206) since the car is 3.8 meters long and the Kayak is 4.5 meters. I’m starting small. My first goal is that in the Summer of 2007 I’ll Kayak from Hertzliya to Tel Aviv and back (around 30km).
  5. I’m going to be 26 in 17 days (21st of January) but I’m still being referred to as the Kid (or sometimes Wiz Kid) by my co-workers, mainly because I formally started to work in the industry at the age of 16 and I’m still the youngest person at work.

OK, now I need to find 5 other people I wish to tag. I feel kind of sleazy continuing this blogosphere chain letter like effect, but what the heck. Let’s go with the flow.

I’m hereby tag Alex, Shay, Liron, Eran (not me) and Yossi.

A friend of mine, Dudu Shmaya, with help from Eyal Post wrote a cool tool called Terminals.

Terminals
is a multi-tab terminal/remote desktop utility that enables you to manage multiple remote servers from the same window (without opening multiple Remote Desktop Connection windows).

While it is not a debugging utility, it is a useful tool when trying to debug on multiple remote servers.

I find it a lot better than using multiple RDC (Remote Desktop Connection) windows and a lot better than the multi terminal/remote desktop utility called (Remote Desktops) which comes with Windows 2003.

The project is hosted at CodePlex and its source code is also available.
For updates and more information about Terminals read here and here.

UPDATE: After I moved to the Beta version of Blogger it seems that when viewing this post directly through its permalink, the widgets does not appear and Blogger didn’t take my site changes per specific post (for some reason) as it did before.
So, you’ll probably going to have to go to main page to see it. Sorry. I’ll look into this issue with Blogger.

UPDATE: I’m on my own WordPress running on my own server now, so it shouldn’t be an issue anymore 🙂
This is going to be an administration post about some of the layout changes I have made to this blog. I’m not going to lie to you, there is a bit of shameless promotion in this, so if you don’t want to continue reading, come back to the next post of this blog (which will be technical. I promise 🙂 ).
You probably noticed the changes on the right side bar of this blog these. Two little yellowish-orangeish boxes appeared. These boxes are Widgets of my day job (Yedda, if you haven’t figured that out yet 😉 ).

These widgets allows you to interact with Yedda.com, a web site that connects people with questions with people with answers, so that the next time you have a debugging, .NET or something of this sort question, just ask it on the Ask widget (the first one) and other people on Yedda (including me) that have knowledge in debugging will automagically be invited to answer your question.

The second box shows frequently asked questions about topics covered in this blog (debugging, asp.net, c#, etc). Go in, see if you can answer some of the people, or just read and learn from the experience of others.

If you have a blog or Web site, feel free to go to the widgets page on Yedda, configure and place your own widget in your blog or Web site. If people will ask questions through your blog or Web site, the question will contain a link back to your blog or Web site.

All in all, this post is also good for you, you’ll be able to have a place where you can ask your questions and people (me included) will answer you :-).

OK, back to the normal schedule. Next post will be technical. I promise!

Everyone else probably wrote about it, so I thought I should write about it too 🙂

Dimitri from Microsoft released an RSS Toolkit for .NET that can be used to consume as well as generate RSS feeds.
You can read more about it in this post on his blog.

Dimitri is the development manager for ASP.NET and a great guy in general.

He actually made this hotfix for a company I used to work for (it was later integrated to one of the service packs of .NET framework v1.1, and I think its also included in .NET 2.0).

The whole ASP.NET threading model and how it works with Single Threaded Apartment (STA) COM objects is a good material for another post, so stay tuned 😉

Monad Beta 2 that works with the RTM release of the .NET Framework 2.0 is released.
For those of you who are outside of the loop (naa… can’t be), Monad is the code name for Microsoft Shell (dubbed by a few as MSH) which is the the first attempt in many years (since cmd for NT came) to give the power of a strong shell to Windows developers/admins.

Get it here while its hot.

What a good way to instrument whatever it is that needs to be instrumented using the full power of the .NET Framework.
I’m sure you (and probably me) will be able to find some use for in debugging scenarios (wink, wink).

Hi everyone!

I didn’t post lately because I was on a personal vacation for two weeks.

I had a few interesting stuff I was working on before I left for the vacation so be sure to check the blog in a couple of days for some cool stuff.