<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Per Lundberg</title>
        <link>http://geekswithblogs.net/plundberg/Default.aspx</link>
        <description>Random thoughts from a BizTalk developer</description>
        <language>sv-FI</language>
        <copyright>plundberg</copyright>
        <managingEditor>per.lundberg@ecraft.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Per Lundberg</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/plundberg/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>TFS and branching</title>
            <link>http://geekswithblogs.net/plundberg/archive/2009/07/07/tfs-and-branching.aspx</link>
            <description>TFS (Team Foundation Server) seems to have some very peculiar ideas regarding branching. Previously, I've used the branching feature, and it's worked just fine. But today, it went absolutely crazy with me.&lt;br /&gt;
&lt;br /&gt;
What I did was this: I tried to create a branch of a solution. Seemed to work fine. Now, the problem was that the  &lt;span style="font-style: italic;"&gt;branched &lt;/span&gt;solution still referred to some of the old projects. And, even worse, the &lt;span style="font-style: italic;"&gt;non-branched&lt;/span&gt; solution referred to the new, branched projects!&lt;br /&gt;
&lt;br /&gt;
(Branching in TFS works like this: a directory is essentially copied on disk, so you get a separate working copy for each branch. Pretty good when it works, but today... a complete disaster)&lt;br /&gt;
&lt;br /&gt;
Just a few minutes ago, I was &lt;span style="font-weight: bold;"&gt;so angry&lt;/span&gt; regarding this. I mean, this is crazy! This is kind of &lt;span style="font-style: italic;"&gt;the&lt;/span&gt; feature regarding branching, the &lt;span style="font-style: italic;"&gt;key issue&lt;/span&gt; is that you want to separate the two different branches from each other. But by doing this, VS2008/TFS essentially destroyed this idea.&lt;br /&gt;
&lt;br /&gt;
Grmbl.. &lt;img src="http://geekswithblogs.net/plundberg/aggbug/133312.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2009/07/07/tfs-and-branching.aspx</guid>
            <pubDate>Tue, 07 Jul 2009 17:43:43 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/133312.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2009/07/07/tfs-and-branching.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/133312.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Instantiating a Dictionary from a LINQ projection, part 2</title>
            <category>.NET</category>
            <category>C#</category>
            <category>LINQ</category>
            <link>http://geekswithblogs.net/plundberg/archive/2009/04/29/instantiating-a-dictionary-from-a-linq-projection-part-2.aspx</link>
            <description>(This posting is a continuation of &lt;a href="javascript:void(0);/*1240987479017*/"&gt;this&lt;/a&gt; blog posting.)&lt;br /&gt;
&lt;br /&gt;
If you want to implement this the OOP way, here you have the subclass code (which I'll use myself).&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;using System.Collections.Generic;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;// Remember to set this to your proper namespace (or use a using statement in&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;// the class with the LINQ projection)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;namespace MyNamespace&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;{&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    /// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    /// Extension methods for the Dictionary generic class.&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    /// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    public class ImprovedDictionary&amp;lt;T1,T2&amp;gt;: Dictionary&amp;lt;T1,T2&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    {&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// Add a key/value pair to the dictionary and return the dictionary reference.&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// &amp;lt;param name="key"&amp;gt;the key&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// &amp;lt;param name="value"&amp;gt;the value&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// &amp;lt;returns&amp;gt;the dictionary&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        public &lt;/span&gt;&lt;span style="font-family: Courier New;"&gt;ImprovedDictionary&lt;/span&gt;&lt;span style="font-family: Courier New;"&gt;&amp;lt;T1, T2&amp;gt; AddWithReturn(T1 key, T2 value)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        {&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;            this[key] = value;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;            return this;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        }&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    }&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;}&lt;/span&gt; &lt;img src="http://geekswithblogs.net/plundberg/aggbug/131563.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2009/04/29/instantiating-a-dictionary-from-a-linq-projection-part-2.aspx</guid>
            <pubDate>Wed, 29 Apr 2009 14:43:40 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/131563.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2009/04/29/instantiating-a-dictionary-from-a-linq-projection-part-2.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/131563.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Instantiating a Dictionary from a LINQ projection</title>
            <category>C#</category>
            <category>.NET</category>
            <category>LINQ</category>
            <link>http://geekswithblogs.net/plundberg/archive/2009/04/29/instantiating-a-dictionary-from-a-linq-projection.aspx</link>
            <description>Ever needed to instantiate a Dictionary from a LINQ projection? It is certainly doable, although not extremely straightforward. My first thought was to try and do this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;var result = from o in ctx.Orders&lt;br /&gt;             where o.ID = OrderID&lt;br /&gt;             select new MyOrderClass&lt;br /&gt;             {&lt;br /&gt;                 ID = o.ID,&lt;br /&gt;                 Created = o.Created,&lt;br /&gt;                 ExtraData = new Dictionary&amp;lt;string,string&amp;gt;().&lt;br /&gt;                     Add("key1", o.Value1).&lt;br /&gt;                     Add("key2", o.Value2")&lt;br /&gt;             };&lt;/pre&gt;
If this would work, it would probably be the most clean-looking solution. The only problem with this though is that the Add() method in the Dictionary class doesn't return the Dictionary object itself... so unfortunately, this makes it unusable from within a LINQ projection.&lt;br /&gt;
&lt;br /&gt;
So, what do we do? If you've done your C# 3.0 homework, the answer should be fairly obvious: An extension method!&lt;br /&gt;
&lt;br /&gt;
Extensions method, albeit not 100% OOP-pure, are a convenient way to be able to "inject" new methods into an existing class. Of course, this is mostly "syntactic sugar". The methods aren't really inserted into the existing class, but the C# compiler lets you call the methods &lt;span style="font-style: italic;"&gt;as if&lt;/span&gt; they were a part of the original class.&lt;br /&gt;
&lt;br /&gt;
When writing this blog posting, I realize that in this specific case, we don't actually have to use an extension method. We could just subclass the Dictionary&amp;lt;string,string&amp;gt;, and add our own method to this subclass. If you want to do it the OOP way, this is preferrable. On the other hand, if you want to practice your C# 3.0 skills, keep reading. :-)&lt;br /&gt;
&lt;br /&gt;
Create a new class, with this content:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;using System.Collections.Generic;&lt;br /&gt;&lt;br /&gt;// Make sure the namespace below is the same for both your extension method class and the class &lt;br /&gt;// where you are writing the LINQ projection, or use a using statement in the latter one.&lt;br /&gt;namespace MyNamespace&lt;br /&gt;{&lt;br /&gt;    /// &amp;lt;summary&amp;gt;&lt;br /&gt;    /// Extension methods for the Dictionary generic class.&lt;br /&gt;    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;    public static class DictionaryExtension&lt;br /&gt;    {&lt;br /&gt;        /// &amp;lt;summary&amp;gt;&lt;br /&gt;        /// Add a key/value pair to the dictionary and return the dictionary reference.&lt;br /&gt;        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;        /// &amp;lt;param name="dictionary"&amp;gt;the dictionary to add the key/value pair to&amp;lt;/param&amp;gt;&lt;br /&gt;        /// &amp;lt;param name="key"&amp;gt;the key&amp;lt;/param&amp;gt;&lt;br /&gt;        /// &amp;lt;param name="value"&amp;gt;the value&amp;lt;/param&amp;gt;&lt;br /&gt;        /// &amp;lt;returns&amp;gt;the dictionary&amp;lt;/returns&amp;gt;&lt;br /&gt;        public static Dictionary&amp;lt;string, string&amp;gt; AddWithReturn(this Dictionary&amp;lt;string, string&amp;gt; dictionary, string key, string value)&lt;br /&gt;        {&lt;br /&gt;            dictionary[key] = value;&lt;br /&gt;            return dictionary;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;br /&gt;
That's it. Now, change the above LINQ query to this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;var result = from o in ctx.Orders&lt;br /&gt;             where o.ID = OrderID&lt;br /&gt;             select new MyOrderClass&lt;br /&gt;             {&lt;br /&gt;                 ID = o.ID,&lt;br /&gt;                 Created = o.Created,&lt;br /&gt;                 ExtraData = new Dictionary&amp;lt;string,string&amp;gt;().&lt;br /&gt;                     AddWithReturn("key1", o.Value1).&lt;br /&gt;                     AddWithReturn("key2", o.Value2")&lt;br /&gt;             };&lt;/pre&gt;
&lt;br /&gt;
Convenient, huh? So, when should we use the extension method approach, and when should we adhere to the OOP standard way of doing it? Well, I'd say like this: If we need to do this on different types of dictionaries (with different key/value types), the extension method approach might be better. I'm not sure if you can subclass a generic class (and have the subclass be generic as well). Maybe you can, and if so, this might be the most elegant way to do it.&lt;br /&gt;
&lt;br /&gt;
If you want to do it OOP (which you should strive for, if possible), only use the approach above when you have to (i.e. when subclassing isn't possible, because the parent class is sealed or similar). &lt;img src="http://geekswithblogs.net/plundberg/aggbug/131562.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2009/04/29/instantiating-a-dictionary-from-a-linq-projection.aspx</guid>
            <pubDate>Wed, 29 Apr 2009 14:37:36 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/131562.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2009/04/29/instantiating-a-dictionary-from-a-linq-projection.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/131562.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ASP.NET 3.5/AJAX.NET-enabled datepicker snippet using the ASP:Calendar control</title>
            <category>ASP.NET</category>
            <category>C#</category>
            <link>http://geekswithblogs.net/plundberg/archive/2009/03/24/asp.net-3.5ajaxnet-enabled-datepicker-snippet-using-the-aspcalendar-control.aspx</link>
            <description>Looking for a &lt;span style="font-weight: bold;"&gt;simple&lt;/span&gt; datepicker that uses AJAX.NET (to avoid full-page postbacks), for your date fields? Look no further! I was on the same "hunt", and ended up writing my own code for it (inspired by other examples/code I was looking at).&lt;br /&gt;
&lt;br /&gt;
The code does all the work using ASP:NET, nothing is done using JavaScript. Below is the code for the solution. This could (and should) be made into a UserControl if you need to use in more than one place&lt;br /&gt;
&lt;br /&gt;
In the .aspx file, put this: (As you see, I am referencing a calendar icon here - use your own icon for this)&lt;br /&gt;
&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                &amp;lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                    &amp;lt;ContentTemplate&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                        &amp;lt;asp:TextBox ID="requestedDeliveryDateTextBox" runat="server" Width="100" /&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                        &amp;lt;asp:ImageButton id="imageButton" runat="server" ImageUrl="~/Images/IconCalendar.png" AlternateText="calendar" &lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                            OnClick="ImageButton_Click" CausesValidation="false" /&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                        &amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                        &amp;lt;div id="calendar" class="calendar" visible="false" runat="server"&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                            &amp;lt;asp:Calendar ID="requestedDeliveryDateCalendar" runat="server" OnSelectionChanged="RequestedDeliveryDateCalendar_SelectionChanged" /&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                        &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                    &amp;lt;/ContentTemplate&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;                &amp;lt;/asp:UpdatePanel&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
In the code-behind (aspx.cs file):&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// The calendar icon was clicked.&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        protected void ImageButton_Click(object sender, EventArgs eventArgs)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        {&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;            // Toggle visibility of the calendar.&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;            calendar.Visible = !calendar.Visible;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        }&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// The selected date in the calendar was changed. This method is called via AJAX.&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        /// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        protected void RequestedDeliveryDateCalendar_SelectionChanged(object sender, EventArgs eventArgs)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        {&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;            requestedDeliveryDateTextBox.Text = BOMisc.GetDatePart(requestedDeliveryDateCalendar.SelectedDate);&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;&lt;br /&gt;
            // We hide the calendar here. You can disable this hiding by removing the following line.&lt;br /&gt;
            calendar.Visible = false;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;            // Move the focus to the textbox below the calendar, to make things convenient for the user filling in the form.&lt;br /&gt;
            // Remove this line or change it to reference your own control instead.&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;            someTextBox.Focus();&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
And finally, the .css portion. We don't do very much styling of the actual calendar here, we just place it on top of the rest (the z-index part), with a white background to make sure the stuff below doesn't "shine through". We also make the calendar be absolutely positioned so that it becomes a true "dropdown" calendar (it will appear "on top" of everything else on the page).&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;.calendar&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;{&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    position: absolute;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    width: 250px;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    padding: 5px;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    background-color: White;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    border: 1px solid #858585;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    z-index: 10;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
That's it for now, hope this helps. Happy datepicking! :- &lt;img src="http://geekswithblogs.net/plundberg/aggbug/130348.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2009/03/24/asp.net-3.5ajaxnet-enabled-datepicker-snippet-using-the-aspcalendar-control.aspx</guid>
            <pubDate>Tue, 24 Mar 2009 13:50:02 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/130348.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2009/03/24/asp.net-3.5ajaxnet-enabled-datepicker-snippet-using-the-aspcalendar-control.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/130348.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Trouble getting TargetInvocationException on your ASP.NET web application?`</title>
            <category>ASP.NET</category>
            <category>C#</category>
            <link>http://geekswithblogs.net/plundberg/archive/2009/03/19/trouble-getting-targetinvocationexception-on-your-asp.net-web-application.aspx</link>
            <description>Sometimes, you get pretty unclear exception messages. The message below is one example of such:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;    Exception type: TargetInvocationException &lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    Exception message: Exception has been thrown by the target of an invocation. &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;    [...some stuff removed...]&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    Stack trace:    at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct&amp;amp; sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object&amp;amp; instance)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.WebControls.DataBoundControl.PerformSelect()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.WebControls.ListView.PerformSelect()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.WebControls.ListView.CreateChildControls()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.Control.EnsureChildControls()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.Control.PreRenderRecursiveInternal()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.Control.PreRenderRecursiveInternal()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.Control.PreRenderRecursiveInternal()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.Control.PreRenderRecursiveInternal()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.Control.PreRenderRecursiveInternal()&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)&lt;/span&gt;&lt;br /&gt;
 &lt;br /&gt;
I mean, this doesn't tell you anything about where &lt;span style="font-weight: bold;"&gt;in your code&lt;/span&gt; the problem occured. Or does it?&lt;br /&gt;
&lt;br /&gt;
Well, actually, it doesn't. But by experience, you can learn that when working on stuff in an ASP.NET context, this &lt;span style="font-style: italic;"&gt;usually&lt;/span&gt; (in my experience) means that the problem was caused by an ObjectDataSource. It might happen with other controls as well, but this is one case where I have seen it.&lt;br /&gt;
&lt;br /&gt;
The ObjectDataSource "invokes" the method on the class you are telling it to get the data from (or perform the update, etc). The problem with this is that the "real" exception is not shown. My guess is that it would be in the "inner" exception in IIS, and this is not shown here, in the event viewer.&lt;br /&gt;
&lt;br /&gt;
Anyway, when debugging the project inside Visual Studio, I still didn't get any exception information (maybe since I have a custom error handler page set up, that could be removed but it turned out not to be necessary). But, what I did get was this:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\ff657321\e4c5c948\App_Web_vtrilm_y.dll', Symbols loaded.&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.ServiceModelSink\3.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll'&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);"&gt;A first chance exception of type 'System.IndexOutOfRangeException' occurred in System.Data.dll&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in System.Web.dll&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;A first chance exception of type 'System.Web.HttpUnhandledException' occurred in System.Web.dll&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;A first chance exception of type 'System.Web.HttpUnhandledException' occurred in System.Web.dll&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;The thread 0x2bb4 has exited with code 0 (0x0).&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The red line at least gives you the &lt;span style="font-style: italic;"&gt;name&lt;/span&gt; of the exception, which in this case was enough to lead me to the real cause of the problem.&lt;br /&gt;
&lt;br /&gt;
Anyway, that's all for now! &lt;img src="http://geekswithblogs.net/plundberg/aggbug/130219.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2009/03/19/trouble-getting-targetinvocationexception-on-your-asp.net-web-application.aspx</guid>
            <pubDate>Thu, 19 Mar 2009 18:26:42 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/130219.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2009/03/19/trouble-getting-targetinvocationexception-on-your-asp.net-web-application.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/130219.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Scheduled tasks - task stopped running when I renamed it</title>
            <category>Windows</category>
            <link>http://geekswithblogs.net/plundberg/archive/2009/03/12/scheduled-tasks---task-stopped-running-when-i-renamed-it.aspx</link>
            <description>Well, the title says it all... I was doing some work on one of our customer's servers, when I found a task in the Scheduled Tasks function in Windows that had the wrong name.&lt;br /&gt;
&lt;br /&gt;
Alright, I renamed it. The next time it was supposed to be run, Windows just ignored it! Very weird indeed.&lt;br /&gt;
&lt;br /&gt;
The solution? As always, the "toggle" trick. :-) We do it with Visual Studio (with the Copy Local setting for referenced assemblies), and, apparently, it can be done with Scheduled Tasks as well. Open the task, uncheck the "enabled" box, Save, open it again, and enable it back again...&lt;br /&gt;
&lt;br /&gt;
Let's hope this helps someone of you guys out there! &lt;img src="http://geekswithblogs.net/plundberg/aggbug/130046.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2009/03/12/scheduled-tasks---task-stopped-running-when-i-renamed-it.aspx</guid>
            <pubDate>Fri, 13 Mar 2009 03:54:58 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/130046.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2009/03/12/scheduled-tasks---task-stopped-running-when-i-renamed-it.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/130046.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Be careful when setting GenerateCSFiles to 1</title>
            <category>BizTalk</category>
            <link>http://geekswithblogs.net/plundberg/archive/2009/03/11/be-careful-when-setting-generatecsfiles-to-1.aspx</link>
            <description>If you, like me, have set the GenerateCSFiles property to 1 (as described &lt;a href="http://arnulfowing.blogspot.com/2007/10/c-generated-code-from-biztalk.html"&gt;here&lt;/a&gt;) to get BizTalk to keep the .cs files after they have been generated from the orchestrations and maps, be a bit aware that it &lt;span style="font-style: italic;"&gt;can&lt;/span&gt; cause some weird problems sometimes.&lt;br /&gt;
&lt;br /&gt;
I just had one of my orchestrations indicating that there was an error with some of the shapes. The map was missing, seemingly. The odd thing was that the whole solution was compiling correctly, so the problem seemed only to affect the editor.&lt;br /&gt;
&lt;br /&gt;
When looking at the "configure map" settings, the map the shape was referring to had just &lt;span style="font-style: italic;"&gt;disappeared&lt;/span&gt;. Yeah, you heard me. It was completely gone. Why? I don't know. The file was located in the project, it was set to Compile on build, but... it didn't work.&lt;br /&gt;
&lt;br /&gt;
The solution: close down Visual Studio. Remove all .cs files from the folder with the orchestration and the folder with the maps. Open the solution, and the problem was gone... &lt;img src="http://geekswithblogs.net/plundberg/aggbug/130010.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2009/03/11/be-careful-when-setting-generatecsfiles-to-1.aspx</guid>
            <pubDate>Wed, 11 Mar 2009 17:19:40 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/130010.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2009/03/11/be-careful-when-setting-generatecsfiles-to-1.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/130010.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Script calling external assemblies - be aware that it uses "dynamic binding"</title>
            <category>BizTalk</category>
            <link>http://geekswithblogs.net/plundberg/archive/2008/12/15/script-calling-external-assemblies---be-aware-that-it-uses.aspx</link>
            <description>I've been having an error lately that looks like this in the event log:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'SomeRoutines.OrderHandler(1f254f9a-5838-1051-30a3-ca1c40b2906f)'.&lt;br /&gt;
The service instance will remain suspended until administratively resumed or terminated.&lt;br /&gt;
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.&lt;br /&gt;
InstanceId: 875947d5-5c01-4ad7-9d62-a033902a3133&lt;br /&gt;
Shape name: ConstructUpdateMessage&lt;br /&gt;
ShapeId: 43a0909e-5877-4e6e-a6a0-c4bbb7c5c644&lt;br /&gt;
Exception thrown from: segment 1, progress 12&lt;br /&gt;
Inner exception: Error encountered while executing the transform SomeRoutines.SomeTransformation. Error:Unable to create the transform..&lt;br /&gt;
       &lt;br /&gt;
Exception type: XTransformationFailureException&lt;br /&gt;
Source: Microsoft.XLANGs.Engine&lt;br /&gt;
Target Site: Void ApplyTransform(System.Type, System.Object[], System.Object[])&lt;br /&gt;
The following is a stack trace that identifies the location where the exception occured&lt;br /&gt;
   at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)&lt;br /&gt;
   at SomeRoutines.OrderHandler.segment1(StopConditions stopOn)&lt;br /&gt;
   at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception&amp;amp; exp)&lt;br /&gt;
Additional error information:&lt;br /&gt;
&lt;br /&gt;
        Could not load file or assembly 'Xxxxxxxxxxx.XxxXxxxxx.Integration.HelperFunctions, Version=1.0.0.1, Culture=neutral, PublicKeyToken=aaaaabbbbbccccdddd'&lt;br /&gt;
or one of its dependencies. The system cannot find the file specified.&lt;br /&gt;
       &lt;br /&gt;
Exception type: FileNotFoundException&lt;br /&gt;
Source: mscorlib&lt;br /&gt;
Target Site: System.Reflection.Assembly nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.Assembly, &lt;br /&gt;
System.Threading.StackCrawlMark ByRef, Boolean, Boolean)&lt;br /&gt;
The following is a stack trace that identifies the location where the exception occured&lt;br /&gt;
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&amp;amp; stackMark, &lt;br /&gt;
Boolean throwOnFileNotFound, Boolean forIntrospection)&lt;br /&gt;
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp;amp; stackMark, Boolean forIntrospection)&lt;br /&gt;
   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp;amp; stackMark, Boolean forIntrospection)&lt;br /&gt;
   at System.Reflection.Assembly.Load(String assemblyString)&lt;br /&gt;
   at Microsoft.XLANGs.BaseTypes.TransformBase.get_TransformArgs()&lt;br /&gt;
   at Microsoft.XLANGs.RuntimeTypes.TransformMetaData..ctor(Type transformBaseType)&lt;br /&gt;
   at Microsoft.XLANGs.RuntimeTypes.TransformMetaData._creator(Type t)&lt;br /&gt;
   at Microsoft.XLANGs.RuntimeTypes.MetadataCache._slowFor(Type t)&lt;br /&gt;
   at Microsoft.XLANGs.RuntimeTypes.MetadataCache.For(Type t)&lt;br /&gt;
   at Microsoft.XLANGs.RuntimeTypes.TransformMetaData.For(Type t)&lt;br /&gt;
   at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;The problem with this was that the .dll version number had been increased from 1.0.0.1 to 2.0.0.0, causing the above error. I had recompiled the project in question and deployed it again, but I still got this error and today I decided to take a look at its cause. It turned out that what I have in the .btm file (BizTalk map) is a scripting function, calling an &lt;span style="font-style: italic;"&gt;external assembly&lt;/span&gt;. Now, when you do that, this is what it looks like in the .btm file:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&amp;lt;ScripterCode&amp;gt;&lt;br /&gt;  &amp;lt;Script Language="ExternalAssembly" Assembly="Xxxxxxxxxxxx.Xxxxxxx.Integration.HelperFunctions, Version=1.0.0.1, Culture=neutral, PublicKeyToken=aaaabbbbbbcccccdddd" &lt;br /&gt;          Class="Xxxxxxxx.Xxxxxxxxxxx.Integration.HelperFunctions.WrapperClass" Function="GetDiscount" &lt;br /&gt;          AssemblyPath="..\IntegrationFunctoids\obj\Debug\Xxxxxxxxxxxx.Xxxxxxxxx.Integration.HelperFunctions.dll" /&amp;gt;&lt;br /&gt;&amp;lt;/ScripterCode&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
What this means in reality is that the binding is not done using the project's "assembly references"; rather, the .dll is loaded at runtime. Sure, that's a pretty convenient thing at times. Right now in this case though, it would have been better to have the .dll files be more "statically" bound to each other.&lt;br /&gt;
&lt;br /&gt;
The problem with dynamic binding (or "dynamic references" might be a better phrase) is that you don't get the errors when you want them: at compile time. Rather, you get it at run time. &lt;span style="font-weight: bold;"&gt;However:&lt;/span&gt; what you &lt;span style="font-style: italic;"&gt;do&lt;/span&gt; get is that you get the error when you try the "Test Map" function in Visual Studio. Once again, clearly, this nice function can not be over-emphasized. :-) &lt;img src="http://geekswithblogs.net/plundberg/aggbug/127898.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2008/12/15/script-calling-external-assemblies---be-aware-that-it-uses.aspx</guid>
            <pubDate>Mon, 15 Dec 2008 19:48:57 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/127898.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2008/12/15/script-calling-external-assemblies---be-aware-that-it-uses.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/127898.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Remember to make callable orchestrations "public"</title>
            <category>BizTalk</category>
            <link>http://geekswithblogs.net/plundberg/archive/2008/11/28/remember-to-make-callable-orchestrations-public.aspx</link>
            <description>&lt;p&gt;If my previous posting was kind of sophisticated, this one is a lot more down-to-earth and basic...&lt;/p&gt;
&lt;p&gt;I've been struggling during the morning trying to use the "Call Orchestration" feature of BizTalk. A pretty straightforward feature. But, I &lt;em&gt;couldn't&lt;/em&gt; just get it to work. If the called orchestration was in the same project as the call&lt;strong&gt;ing&lt;/strong&gt; orchestration, it worked Just Fine&amp;lt;tm&amp;gt;, but as soon as I tried to put the called orchestration in its proper place, it just failed.&lt;/p&gt;
&lt;p&gt;The solution? Well, I got the answer from someone who is much more experienced with BizTalk than me: &lt;em&gt;Make the called orchestration public&lt;/em&gt;. This is pretty straightforward if you think about: orchestrations are really standard CLR classes (even though not generated manually by writing C# or VB.NET code), and as such, they have visibility parameters just like classes usually have.&lt;/p&gt;
&lt;p&gt;If it doesn't immediately work after making sure the callee orchestration is public, try rebuilding the project that is &lt;strong&gt;referring&lt;/strong&gt; to the callee. Yes, you heard me right. Even thought it might fail (since you are likely to have a Call Orchestration shape that is unconfigured), something happens when you build it that sometimes makes it work.&lt;/p&gt;
&lt;p&gt;Restarting Visual Studio is also something that can be helpful. &lt;img alt="" src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt; For me, in this specific case, building the project didn't work straight away - one of the files was being locked. But when I restarted Visual Studio, it found the callee orchestration anyway, so - problem solved.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/plundberg/aggbug/127430.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2008/11/28/remember-to-make-callable-orchestrations-public.aspx</guid>
            <pubDate>Fri, 28 Nov 2008 16:09:40 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/127430.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2008/11/28/remember-to-make-callable-orchestrations-public.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/127430.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Weird problems with document with only one node, the root node (no content nodes)</title>
            <category>BizTalk</category>
            <link>http://geekswithblogs.net/plundberg/archive/2008/11/28/weird-problems-with-document-with-only-a-root-node.aspx</link>
            <description>&lt;p&gt;I ran into a strange issue the other day with BizTalk Server 2006 R2. Imagine a map (.btm file) that takes multiple messages as its input. Imagine two of those messages being of the same document type, having the same schema. Now... make the first message be normal, like this (this is an excerpt from the full multipart input message to the map):&lt;/p&gt;
&lt;pre&gt;  &amp;lt;InputMessagePart_2&amp;gt;&lt;br /&gt;    &amp;lt;ns4:stock_warehouse_fetch_response xmlns:ns4="&lt;a href="http://stockwarehouse/"&gt;http://StockWarehouse&lt;/a&gt;"&amp;gt;&lt;br /&gt;      &amp;lt;ns4:stock_warehouse stock_warehouse_id="170A9532-BD20-11DD-85B6-3DFC55D89593" &lt;br /&gt;                           company_id="1EBB0C44-BD20-11DD-9025-69FC55D89593" &lt;br /&gt;                           &lt;em&gt;[... More attributes existed but have been removed to preserve &lt;br /&gt;                           the integrity of the customer ]&lt;/em&gt; /&amp;gt;&lt;br /&gt;    &amp;lt;/ns4:stock_warehouse_fetch_response&amp;gt;&lt;br /&gt;  &amp;lt;/InputMessagePart_2&amp;gt;&lt;br /&gt;  &amp;lt;InputMessagePart_3&amp;gt;&lt;br /&gt;    &amp;lt;ns4:stock_warehouse_fetch_response xmlns:ns4="&lt;a href="http://stockwarehouse/"&gt;http://StockWarehouse&lt;/a&gt;"&amp;gt;&lt;br /&gt;      &amp;lt;!-- This is the part that causes the problems --&amp;gt;&lt;br /&gt;    &amp;lt;/ns4:stock_warehouse_fetch_response&amp;gt;&lt;br /&gt;  &amp;lt;/InputMessagePart_3&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;
When I used the message above (with more messages in the multipart message and so forth), a &lt;strong&gt;very weird thing&lt;/strong&gt; occured: the map output was &lt;em&gt;completely empty&lt;/em&gt;, the only thing that remained was the root node! Obviously, many of the input elements existed in the input messages, so this is clearly a bug in BizTalk (IMO). The problem first occured when running the application in BizTalk Server 2006 R2, but was reproduced with the Visual Studio-integrated "test map" function.&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;The solution? Add a "content node" in the document, like below. It seems like BizTalk really, &lt;em&gt;really&lt;/em&gt; dislikes documents with only a root node. There must be at least one content node in &lt;strong&gt;all&lt;/strong&gt; the input documents to a map. Otherwise, the map output is completely eradicated, except for the root node.&lt;/font&gt;&lt;/p&gt;
&lt;pre&gt;  &amp;lt;InputMessagePart_3&amp;gt;&lt;br /&gt;    &amp;lt;ns4:stock_warehouse_fetch_response xmlns:ns4="&lt;a href="http://stockwarehouse/"&gt;http://StockWarehouse&lt;/a&gt;"&amp;gt;&lt;br /&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;      &amp;lt;ns4:stock_warehouse&amp;gt;&amp;lt;/ns4:stock_warehouse&amp;gt;&lt;/strong&gt;&lt;br /&gt;&lt;/font&gt;    &amp;lt;/ns4:stock_warehouse_fetch_response&amp;gt;&lt;br /&gt;  &amp;lt;/InputMessagePart_3&amp;gt; &lt;/pre&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;Well, that's it for this time. I hope this helped you, it would have helped me. &lt;img alt="" src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;&lt;/font&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/plundberg/aggbug/127429.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>plundberg</dc:creator>
            <guid>http://geekswithblogs.net/plundberg/archive/2008/11/28/weird-problems-with-document-with-only-a-root-node.aspx</guid>
            <pubDate>Fri, 28 Nov 2008 15:47:15 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/plundberg/comments/127429.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/plundberg/archive/2008/11/28/weird-problems-with-document-with-only-a-root-node.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/plundberg/comments/commentRss/127429.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
