<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Rakesh Rajan's blog</title><link>http://msmvps.com/blogs/rakeshrajan/default.aspx</link><description>Thoughts on .NET, software and a few trivial things...</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Class to Xml tool (test version)</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2006/02/18/84120.aspx</link><pubDate>Sat, 18 Feb 2006 15:15:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:84120</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=84120</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2006/02/18/84120.aspx#comments</comments><description>&lt;H1&gt;Summary &lt;/H1&gt;
&lt;P&gt;CTX (Class to Xml) tool is a very simple tool which provides you a code editing environment in C# and VB.NET, compiles the source codes and lets you see the Xml output of all serializable types once successfully compiled. &lt;/P&gt;&lt;BR&gt;&lt;a href="http://msmvps.com/photos/rakesh_rajans_blog/images/84118/original.aspx" target=_blank&gt;&lt;IMG src="/photos/rakesh_rajans_blog/images/84118/500x358.aspx" border=0&gt; &lt;/A&gt;
&lt;H1&gt;Intro&lt;/H1&gt;
&lt;P&gt;Do you use Xml Serialization in .NET – if yes, you might be interested in this tool! &lt;/P&gt;
&lt;P&gt;Have you ever thought "Hmm…now that I have written a serializable class, I wonder how will it look when it is Xml Serialized"? &lt;/P&gt;
&lt;P&gt;If yes, you are in good company :). Sometime back I was involved in a project in which I had to develop a lot of business entity classes which would be Xml Serialized. Since these classes had to adhere to a specific schema, I had a tough time synchronizing the Xml Attributes and the final xml schema it generated when xml serialized. &lt;/P&gt;
&lt;P&gt;The sequence of how I would go about doing this was like this: 
&lt;OL&gt;
&lt;LI&gt;I would develop a draft version of xml schema. 
&lt;LI&gt;I would create a simple console project in which I would start writing the class to be serialized. 
&lt;LI&gt;This project will have a small code snippet which will create an instance of the serializable class and xml serialize it and then finally print out the xml output. 
&lt;LI&gt;I will keep comparing this output with my xml schema until they are in sync.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;As I got involved in more and more projects (many of them my own :) ) which came to have similar requirements, I decided to create a little tool which would automate the above tasks. &lt;/P&gt;
&lt;P&gt;Introducing the Class to Xml (CTX) tool - a very simple tool which provides you a code editing environment in C# and VB.NET, compiles the source codes and lets you see the Xml output of all serializable types once successfully compiled. &lt;/P&gt;
&lt;H1&gt;How to use the tool&lt;/H1&gt;
&lt;P&gt;
&lt;OL&gt;
&lt;LI&gt;Open up the source code files of the serializable classes you want to get the xml for (including all the files that are referenced) and select the language. 
&lt;LI&gt;Press F5. The whole list of files will be compiled. 
&lt;LI&gt;If compilation is successful, the Output pane would list all serializable types available in the assembly. If compilation failed, the Errors pane would list the errors. 
&lt;LI&gt;After successful compilation, select the required serializable type in the combo box; the Xml representation is displayed in the Serialized Xml text box. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;/P&gt;
&lt;H1&gt;Download&lt;/H1&gt;
&lt;P&gt;The current test version&amp;nbsp;source code (probably terrible) in Visual Studio 2005 is available here &lt;B&gt;(The site is down due to site maintenance, please wait while I resolve this ASAP)&lt;/B&gt;.&lt;BR&gt;Do check it out and let me know your comments. &lt;/P&gt;
&lt;P&gt;I plan to finalize the code soon…er, I have no idea how “soon” though&amp;nbsp;:) &lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=84120" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+2.0/default.aspx">.NET 2.0</category></item><item><title>Digitally mastering my portraits</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2006/01/15/81142.aspx</link><pubDate>Sun, 15 Jan 2006 19:03:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:81142</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=81142</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2006/01/15/81142.aspx#comments</comments><description>&lt;P&gt;I used to paint portraits in oil when I was kid.&lt;/P&gt;
&lt;P&gt;For different reasons, I had not been able to maintain them&amp;nbsp;as a result of which they have aged a lot :(. &lt;/P&gt;
&lt;P&gt;The last time I went home, I took close up snapshots of my works with my &lt;A href="http://www.dpreview.com/reviews/specs/Canon/canon_a510.asp" target=_blank&gt;Canon PowerShot A510&lt;/A&gt;, and now I am repairing them with Photoshop :).&lt;/P&gt;
&lt;P&gt;Check out the initial stages of&amp;nbsp;the "repair" (extracted the subjects and set the background to 0,0,0) below:&lt;/P&gt;
&lt;P&gt;
&lt;a href="http://msmvps.com/photos/rakesh_rajans_blog/images/84158/original.aspx" target=_blank&gt;
&lt;IMG src="/photos/rakesh_rajans_blog/images/84158/thumb.aspx" border=0&gt; 
&lt;/A&gt;
&lt;a href="http://msmvps.com/photos/rakesh_rajans_blog/images/84157/original.aspx" target=_blank&gt;
&lt;IMG src="/photos/rakesh_rajans_blog/images/84157/thumb.aspx" border=0&gt;
&lt;/A&gt;
&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=81142" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/Personal/default.aspx">Personal</category></item><item><title>XML Serialize IDictionary types (Hashtable, DictionaryBase etc.)</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2006/01/15/81105.aspx</link><pubDate>Sun, 15 Jan 2006 12:42:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:81105</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=81105</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2006/01/15/81105.aspx#comments</comments><description>&lt;H2&gt;Problem &lt;/H2&gt;
&lt;P&gt;You want to serialize a type; however it: 
&lt;UL&gt;
&lt;LI&gt;implements &lt;SPAN class=code&gt;IDictionary&lt;/SPAN&gt;, or 
&lt;LI&gt;derives from &lt;SPAN class=code&gt;DictionaryBase&lt;/SPAN&gt;, contains a member which implements &lt;SPAN&gt;IDictionary&lt;/SPAN&gt; or derives from &lt;SPAN class=code&gt;DictionaryBase&lt;/SPAN&gt;, &lt;/LI&gt;&lt;/UL&gt;which causes XmlSerializer to throw an exception: &lt;BR&gt;&lt;SPAN&gt;"System.NotSupportedException: The type X is not supported because it implements IDictionary". &lt;/SPAN&gt;
&lt;P&gt;&lt;/P&gt;
&lt;H2&gt;Solution &lt;/H2&gt;
&lt;P&gt;Override XmlSerialization by making the type implement the &lt;SPAN&gt;System.Xml.Serialization.IXmlSerializable &lt;/SPAN&gt;class. Define how you want the object to be serialized in XML in the &lt;SPAN class=code&gt;WriteXml&lt;/SPAN&gt; method, and define how you could recreate the object from an xml string in the &lt;SPAN&gt;ReadXml&lt;/SPAN&gt; method. &lt;/P&gt;
&lt;H2&gt;Code &lt;/H2&gt;
&lt;P&gt;Download the full code &lt;A href="http://rakeshrajan.com/data/IXmlSerializable/IXmlSerializable.zip" target=_blank&gt;here&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;The &lt;SPAN class=code&gt;WriteXml&lt;/SPAN&gt; and &lt;SPAN class=code&gt;ReadXml&lt;/SPAN&gt; methods used in the sample follow. &lt;/P&gt;&lt;PRE&gt;public void WriteXml(System.Xml.XmlWriter writer)
{
	// Used while Serialization

	// Serialize each BizEntity this collection holds
	foreach( string key in this.Dictionary.Keys )
	{
		Serializer.Serialize(writer, this.Dictionary[key]);
	}
}

public void ReadXml(System.Xml.XmlReader reader)
{
	// Used while Deserialization

	// Move past container
	reader.Read();

	// Deserialize and add the BizEntitiy objects
	while( reader.NodeType != XmlNodeType.EndElement )
	{
		BizEntity entity;

		entity = Serializer.Deserialize(reader) as BizEntity;
		reader.MoveToContent();
		this.Dictionary.Add(entity.Key, entity);
	}
}
&lt;/PRE&gt;
&lt;H2&gt;Description &lt;/H2&gt;
&lt;P&gt;By default, XML Serialization does not serialize types that implement &lt;SPAN class=code&gt;IDictionary&lt;/SPAN&gt;; it throws an exception when you attempt to do so. This comes quite in the way when you need to switch serialization techniques, or have custom collections which derive from &lt;SPAN class=code&gt;DictionaryBase&lt;/SPAN&gt; or any other sort of scenario. &lt;/P&gt;
&lt;P&gt;The workaround for this problem is to let XML Serializer know how to serialize your &lt;SPAN class=code&gt;IDictionary&lt;/SPAN&gt; types yourself, by implementing the &lt;SPAN&gt;System.Xml.Serialization.IXmlSerializable&lt;/SPAN&gt; class. This interface declares three methods - &lt;SPAN class=code&gt;ReadXml&lt;/SPAN&gt;, &lt;SPAN class=code&gt;WriteXml&lt;/SPAN&gt; and &lt;SPAN class=code&gt;GetSchema&lt;/SPAN&gt;. &lt;/P&gt;
&lt;P&gt;When XmlSerializer attempts to serialize a type and finds that it implements &lt;SPAN class=code&gt;IXmlSerializable&lt;/SPAN&gt;, the serializer would simply pass control to the &lt;SPAN class=code&gt;ReadXml&lt;/SPAN&gt; (during deserialization) or &lt;SPAN class=code&gt;WriteXml&lt;/SPAN&gt; (during serialization) methods. In other words, you yourself handle how serialization and deserialization should happen. &lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=81105" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+FAQ/default.aspx">.NET FAQ</category></item><item><title>This blog gets updated</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/12/14/79064.aspx</link><pubDate>Wed, 14 Dec 2005 03:14:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:79064</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=79064</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/12/14/79064.aspx#comments</comments><description>&lt;P&gt;Now that &lt;A&gt;http://msmvps.com&lt;/A&gt; runs on CS (thanks a lot to Susan and team!), I will be cross posting for a while - here and at &lt;A href="http://rakeshrajan.com/blog/"&gt;http://rakeshrajan.com/blog/&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;Also, since some of the readers complain that the LuxLegend skin I am using isn't really attractive (maybe because it's pretty dark), I have set the skin here to LuxLegend - light :)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=79064" width="1" height="1"&gt;</description></item><item><title>I have moved!</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/10/10/69909.aspx</link><pubDate>Mon, 10 Oct 2005 06:17:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:69909</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=69909</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/10/10/69909.aspx#comments</comments><description>&lt;P&gt;Friends, now that I have bought &lt;A href="http://www.rakeshrajan.com/" target=_blank&gt;my own little niche&lt;/A&gt; in the web world, I have decided to shift this blog to this cool &lt;A href="http://rakeshrajan.com/blog" target=_blank&gt;new place&lt;/A&gt;. It runs on &lt;A href="http://www.communityserver.org/" target=_blank&gt;Community Server&lt;/A&gt; with &lt;A href="http://communityserver.org/files/40/themes_and_skins/entry498174.aspx" target=_blank&gt;LuxLegend &lt;/A&gt;as the skin. Please update your links.&lt;/P&gt;
&lt;P&gt;For your convenience, I have duplicated these posts at the new blog. However note that I haven&amp;#8217;t copied comments or trackbacks. Please refer to this for the same. &lt;/P&gt;
&lt;P&gt;Wish you a great time out there! &lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=69909" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/Personal/default.aspx">Personal</category></item><item><title>Just posted a new article - Delegate and Events Internals</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/10/07/69432.aspx</link><pubDate>Fri, 07 Oct 2005 11:46:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:69432</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=69432</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/10/07/69432.aspx#comments</comments><description>Check it out here: &lt;BR&gt;&lt;A href="http://www.codeproject.com/useritems/DelegatesNEventsInternals.asp" target=_blank&gt;http://www.codeproject.com/useritems/DelegatesNEventsInternals.asp&lt;/A&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=69432" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/Personal/default.aspx">Personal</category></item><item><title>Off to the Global Summit! :)</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/09/27/68043.aspx</link><pubDate>Tue, 27 Sep 2005 22:53:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:68043</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=68043</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/09/27/68043.aspx#comments</comments><description>&lt;P&gt;A&amp;nbsp;few more hours, and I will be on board the first flight of my trip to Redmond for attending the Global MVP Summit.&lt;/P&gt;
&lt;P&gt;It's quite wonderful to know that within a few hours I will be meeting people I have only &amp;#8220;seen&amp;#8221; at newsgroups.&lt;/P&gt;
&lt;P&gt;Hope the journey will go on fine.&lt;/P&gt;
&lt;P&gt;Updates after I come back on October 5th.&lt;/P&gt;
&lt;P&gt;See ya! &lt;a title="" href="." &gt;&lt;img src="http://msmvps.com/images/msmvps_com/rakeshrajan/1260/o_smile.gif" border=0 /&gt;&lt;/a&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=68043" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/Personal/default.aspx">Personal</category></item><item><title>.NET Certifications FAQ</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/09/23/67399.aspx</link><pubDate>Fri, 23 Sep 2005 06:57:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:67399</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=67399</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/09/23/67399.aspx#comments</comments><description>&lt;P&gt;This is something that comes up frequently. &lt;/P&gt;
&lt;P&gt;Check out the below link I wrote a long long time ago. Hope it has some helpful information. Please drop me a mail if you have questions.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://t-mug.org/certification.aspx" target=_blank&gt;http://t-mug.org/certification.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=67399" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+FAQ/default.aspx">.NET FAQ</category></item><item><title>How to make Visual Studio .NET create web projects in a user defined folder</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/08/22/63652.aspx</link><pubDate>Mon, 22 Aug 2005 14:57:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:63652</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=63652</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/08/22/63652.aspx#comments</comments><description>&lt;P&gt;Just published this here: &lt;BR&gt;&lt;A href="http://support.microsoft.com/kb/555436" target=_blank&gt;http://support.microsoft.com/kb/555436 &lt;/A&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=63652" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+FAQ/default.aspx">.NET FAQ</category></item><item><title>How to share custom application configuration settings across projects in .NET</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/08/16/62853.aspx</link><pubDate>Tue, 16 Aug 2005 19:12:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:62853</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=62853</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/08/16/62853.aspx#comments</comments><description>&lt;P&gt;Just published this here: &lt;BR&gt;&lt;A href="http://support.microsoft.com/kb/555396" target=_blank&gt;http://support.microsoft.com/kb/555396&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Interestingly, I had stumbled upon this while answering this post:&lt;BR&gt;&lt;A href="http://www.msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.dotnet.general&amp;amp;mid=ff9719e6-3829-4122-8b23-565087e9b1a4&amp;amp;sloc=en-us" target=_blank&gt;http://www.msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.dotnet.general&amp;amp;mid=ff9719e6-3829-4122-8b23-565087e9b1a4&amp;amp;sloc=en-us&lt;/A&gt; &lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=62853" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+FAQ/default.aspx">.NET FAQ</category></item><item><title>Session Start event in .NET 2.0 seems to be updated</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/08/07/61937.aspx</link><pubDate>Mon, 08 Aug 2005 04:17:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:61937</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=61937</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/08/07/61937.aspx#comments</comments><description>&lt;p&gt;
In .NET 1.x, the session start event would be invoked if an unhandled exception propagates out of the application scope (in additional to the normal invocation). This meant that the code in the session start event handler may be called multiple times during the same session, which isn’t good.
&lt;/p&gt;
&lt;p&gt;
I fiddled with little snippets of code in Whidbey beta 2, and it seems this has been resolved in .NET 2.0.
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=61937" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+2.0/default.aspx">.NET 2.0</category></item><item><title>It's my birthday!</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/30/59947.aspx</link><pubDate>Sat, 30 Jul 2005 23:21:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:59947</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=59947</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/30/59947.aspx#comments</comments><description>&lt;p&gt;
Dear folks, it's my birthday today! You ask how old I am? Keep guessing, 'coz I won't tell ;)
&lt;/p&gt;

&lt;p&gt;
Hmm...come to think of it - I haven't decided on any new 'age' resolutions...so I guess I would just continue coding.
&lt;/p&gt;

&lt;p&gt;
Nothing special planned for today...being a Saturday (which is a holiday for my company), I would miss out all fun of being at office on a b'day.  
&lt;br /&gt;
In case you didn't know, it's our unofficial custom @ office that b'day guys/gals get surrounded by collegues who would first sing the b'day song, 'present' a few b'day kicks and then finally scream 'Treat'! &lt;a title="" href="." &gt;&lt;img src="http://msmvps.com/images/msmvps_com/rakeshrajan/1260/o_smile.gif" border=0 /&gt;&lt;/a&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=59947" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/Personal/default.aspx">Personal</category></item><item><title>Bugs, developers and testers</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/28/59838.aspx</link><pubDate>Fri, 29 Jul 2005 01:29:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:59838</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=59838</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/28/59838.aspx#comments</comments><description>&lt;p&gt;
        Developers usually develop applications with the objective of getting the functionality
        up and running as quick as possible. After the functionality is complete, they would
        proceed to test their code.
        &lt;br /&gt;
        Unfortunately, many developers are neither inclined to find bugs in their own code
        (for, that just means more work), nor would most have that special 'testing' knack
        to do so. That's where testers come in.&lt;/p&gt;
    &lt;p&gt;
        However, many testers I have seen weren't into hard-code development in their career; they
        were just testers from the very beginnings. There are good and bad points to this.
        Being completely ignorant about how an application is coded, the tester might be
        able to test things that would be extremely random and 'creative' – something a
        developer would have never thought.
        &lt;br /&gt;
        For instance, I recently chanced to see such a tester testing an ASP.NET web form
        page which had several text-input boxes, one of which had a validation criterion
        of accepting (while typing) only numbers. After testing them by typing values into
        text boxes directly, this guy opened up an instance of notepad, typed in several
        words, copied them into the clipboard, and pasted it into the text box. The text
        box happily accepted the input without validating! These are things routine developers
        wouldn't think about.&lt;/p&gt;
    &lt;p&gt;
        However, testers who weren't developers before could miss out finding serious bugs.
        For example, some time back I was involved in an ASP.NET project for a short period
        of time. The project had a screen for displaying and editing information of a user,
        and the user ids were passed in the query string. Obviously, a user is supposed
        to view only his own information.
        &lt;br /&gt;
        Now, the tester who was assigned this screen wasn't concerned about those "queer
        set of strings" in the address bar. Needless to say, he missed this very obvious
        but critical bug - a user could change the value passed in the query string to access
        information of any other user! Sadly though, the developer who coded the screen
        never thought of this bug either!&lt;/p&gt;
    &lt;p&gt;
        This brings us to this point – we need both non-dev 'creative' testers and the dev
        testers to test applications. Skipping over one of these can result in a product
        of inferior quality. We can't be sure that a developer would find bugs in his
        own code, unless he has a high degree of professionalism.
    &lt;/p&gt;
    &lt;p&gt;
        In my opinion, I feel a solution like follows could help ensure that both kinds
        of tests happen.
    &lt;/p&gt;
        &lt;ul&gt;
            &lt;li&gt;Make the technical lead of the project test the code of his team members, for he
                would (hopefully) have a greater deal of responsibility on product quality than
                his subordinates. &lt;/li&gt;
            &lt;li&gt;Assign a non-techie tester to test the application, so that he could find out the
                remaining 'creative' bugs. &lt;/li&gt;
            &lt;li&gt;And if you find the rare breed of developer/tester who can do both, hire him! &lt;/li&gt;
        &lt;/ul&gt;
    &lt;p&gt;
        More importantly, flaws in the design and structure of the application are more
        critical (in magnitudes), and will have to be caught as early as possible. However,
        this will require a different kind of approach. More on this later...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=59838" width="1" height="1"&gt;</description></item><item><title>HttpUnhandledException and HttpParseException - they are now Serializable :)</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/08/56718.aspx</link><pubDate>Sat, 09 Jul 2005 00:09:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:56718</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=56718</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/08/56718.aspx#comments</comments><description>&lt;P&gt;In .NET 1.x, these exceptions weren't serializable - which meant we couldn't persist/transport them in a direct manner.&lt;/P&gt;
&lt;P&gt;Thankfully, .NET 2.0 has both of them serializable &lt;a title="" href="." &gt;&lt;img src="http://msmvps.com/images/msmvps_com/rakeshrajan/1260/o_smile.gif" border=0 /&gt;&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=56718" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+2.0/default.aspx">.NET 2.0</category></item><item><title>System.Data.OleDb.OleDbException: Unspecified error</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/04/56461.aspx</link><pubDate>Mon, 04 Jul 2005 20:04:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:56461</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=56461</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/04/56461.aspx#comments</comments><description>&lt;DIV class=blogBody&gt;
&lt;P&gt;&lt;SPAN class=codeSnippet&gt;System.Data.OleDb.OleDbException: Unspecified error&lt;/SPAN&gt; while calling the &lt;CODE&gt;Connection.Open&lt;/CODE&gt; method on an Access or Excel file within ASP.NET. This is an issue you could face while opening Excel or Access files as data sources in ASP.NET using OleDb Jet.&lt;/P&gt;
&lt;P&gt;
&lt;H3&gt;Cause Number 1&lt;/H3&gt;ASP.NET/Impersonated account doesn&amp;#8217;t have enough privileges to create the ldb file. &lt;BR&gt;&lt;BR&gt;&lt;B&gt;Resolution &lt;/B&gt;Give the ASP.NET user account create/write privileges to the folder where the excel/access file is placed. If you are using impersonation, give the impersonated account the said privileges. 
&lt;P&gt;&lt;BR&gt;&lt;/P&gt;&lt;BR&gt;
&lt;P&gt;
&lt;H3&gt;Cause Number 2 &lt;/H3&gt;Impersonated account doesn&amp;#8217;t have enough privileges to create temporary files. &lt;BR&gt;&lt;BR&gt;&lt;B&gt;Description &lt;/B&gt;When you open excel or access files using Jet, it requires creation of temporary files. Under ASP.NET, these files will be created under the &lt;SPAN class=codeSnippet&gt;C:\Documents and Settings\MachineName\ASPNET\Local Settings\Temp folder&lt;/SPAN&gt;. By default, the ASP.NET user account is given full access to this folder. Now, when you are using impersonation, the impersonated account naturally wouldn&amp;#8217;t have access to this folder. Consequently, the Jet engine wouldn&amp;#8217;t be able to create the temporarily files while opening connections to excel or access files under ASP.NET. Due to this, the OleDb provider throws an exception with no specific message - &lt;SPAN class=codeSnippet&gt;System.Data.OleDb.OleDbException: Unspecified error.&lt;/SPAN&gt; &lt;BR&gt;&lt;BR&gt;&lt;B&gt;Resolution &lt;/B&gt;Give the impersonated account full access to the above mentioned folder. &lt;BR&gt;Check out the Microsoft support article &lt;A href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;825738"&gt;here&lt;/A&gt;[&lt;A href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;825738" target=_blank&gt;^&lt;/A&gt;] 
&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=56461" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Just finished uploading the MVP Summit pics</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/02/56376.aspx</link><pubDate>Sun, 03 Jul 2005 03:06:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:56376</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=56376</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/07/02/56376.aspx#comments</comments><description>&lt;P&gt;I just completed uploading pics from the MVP Summit held @ Singapore on April 2005 (yes...it was long overdue :( ).&lt;/P&gt;
&lt;P&gt;Here are the MSN Spaces and .Text links to the photo albums:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;MSN Spaces: &lt;A target=_blank href="http://spaces.msn.com/members/rakeshrajan/"&gt;http://spaces.msn.com/members/rakeshrajan/&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;.Text: &lt;A target=_blank HREF="/rakeshrajan/gallery/1348.aspx"&gt;http://msmvps.com/rakeshrajan/gallery/1348.aspx&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;So why did I add them at both locations? MSN's photo album features are really good (like uploading, slide show etc.)...but the pics look a bit odd...they seem to be rescaled with lesser quality. With .Text however, you need to struggle with uploading, live without the slide show and other cool features of MSN; yet, the pics looks great. That's why.&lt;/P&gt;
&lt;P&gt;Happy browsing...&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=56376" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/Personal/default.aspx">Personal</category></item><item><title>Why Multiple Inheritance was not implemented in .NET</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/06/29/56183.aspx</link><pubDate>Wed, 29 Jun 2005 15:56:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:56183</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>20</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=56183</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/06/29/56183.aspx#comments</comments><description>&lt;P&gt;Just came across this blog entry on why Multiple Inheritance was not implemented in .NET.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/csharpfaq/archive/2004/03/07/85562.aspx" target=_blank&gt;http://blogs.msdn.com/csharpfaq/archive/2004/03/07/85562.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=56183" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+FAQ/default.aspx">.NET FAQ</category></item><item><title>Just posted my first ASP.NET article!</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/06/05/50543.aspx</link><pubDate>Mon, 06 Jun 2005 01:26:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:50543</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=50543</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/06/05/50543.aspx#comments</comments><description>									&lt;p&gt;
										I just posted my first ever &lt;a href="http://www.codeproject.com/aspnet/ErrorHandlingASPNET.asp" target="_blank"&gt;
											ASP.NET article&lt;/a&gt; :)
									&lt;p&gt;
										That too, after a significant time!
									&lt;/p&gt;
									&lt;p&gt;
										Hmm...I should write more frequently...
									&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=50543" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>How to find out the immediate calling method</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/05/02/45408.aspx</link><pubDate>Tue, 03 May 2005 03:55:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:45408</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=45408</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/05/02/45408.aspx#comments</comments><description>									&lt;p&gt;
										Use the
										&lt;span&gt;StackFrame&lt;/span&gt;
										and
										&lt;span&gt;StackTrace&lt;/span&gt;
									classes.
									&lt;p&gt;For example:
										&lt;pre&gt;

	public static void SourceMethod()
	{
		TargetMethod();
	}

	public static void TargetMethod()
	{
		StackTrace st = new StackTrace();

		// This will output 'SourceMethod'
		Console.WriteLine(st.GetFrame(1).GetMethod().Name);
	}

&lt;/pre&gt;
									&lt;/p&gt;
									&lt;p&gt;
										&lt;br&gt;
										&lt;b&gt;Note: &lt;/b&gt;
										&lt;br /&gt;
										Code optimizations might give you different results. &amp;nbsp;Some methods may 
										even be completely optimized out.&amp;nbsp; But this code should work fine without 
										any optimizations.
									&lt;/p&gt;
									&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=45408" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+FAQ/default.aspx">.NET FAQ</category></item><item><title>Static readonly versus constants</title><link>http://msmvps.com/blogs/rakeshrajan/archive/2005/05/01/45260.aspx</link><pubDate>Sun, 01 May 2005 16:03:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:45260</guid><dc:creator>rakeshrajan</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/rakeshrajan/rsscomments.aspx?PostID=45260</wfw:commentRss><comments>http://msmvps.com/blogs/rakeshrajan/archive/2005/05/01/45260.aspx#comments</comments><description>									&lt;p&gt;
									Though both would appear similar – they are both read only and generate almost 
									similar IL code – they have a number of differences.&amp;nbsp; Here they are:
									&lt;p&gt;
										Constants are evaluated at compile time, whereas
										&lt;span&gt;static&lt;/span&gt;
										(or
										&lt;span&gt;static readonly&lt;/span&gt;) variables at runtime.
									&lt;/p&gt;
									&lt;p&gt;
										So, when the compiler generates the IL, the value of the constant is burned 
										into the IL wherever it is referenced.&amp;nbsp; Consequently, when you change the 
										value of a constant, all the client applications referring the constant will 
										have to be recompiled.&amp;nbsp;
									&lt;/p&gt;
									&lt;p&gt;
										However, if you change the value of a static field, you only need to recompile 
										that library and none of the clients.&amp;nbsp; This is because the IL generated 
										would only be referencing the static field, and will not have the value burned 
										into it.
									&lt;/p&gt;
									&lt;p&gt;
										Though constants and
										&lt;span&gt;readonly&lt;/span&gt;
										variables are both read only,
										&lt;span&gt;readonly&lt;/span&gt;
										is a runtime constant, and can hold references types (like
										&lt;span&gt;DataSet&lt;/span&gt;
										etc.).&amp;nbsp; Constants on the other hand cannot hold reference types except for
										&lt;span&gt;string&lt;/span&gt;
										and
										&lt;span&gt;nul&lt;/span&gt;l.
									&lt;/p&gt;
									&lt;p&gt;
										Yet another difference is that constants need to be initialized at the 
										declaration itself, whereas
										&lt;span&gt;readonly&lt;/span&gt;
										fields may be initialized either at the declaration or in a constructor (or in 
										static constructors/type initializers).
									&lt;/p&gt;
									&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=45260" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/rakeshrajan/archive/tags/.NET+FAQ/default.aspx">.NET FAQ</category></item></channel></rss>