Talk on Velocity (AppFabric Caching)

A blog post?  Here?? Yes, I know it has been an extremely long while.  I’ve
been doing some writing over here,
for the blog associated with my new company (Marcato Partners, LLC) that is focused
on agile development coaching.  Even with that focus, I’m still doing technical
consulting of course – I just delivered this
talk on Velocity (AppFabric Caching) at the Twin Cities Code Camp this past weekend
(April 10, 2010).  I’ll be delivering something close to this again at the May
20th, 2010 at the local Connected Systems User Group.

Visual Studio 2010 and .NET 4 Released

The final release of Visual Studio 2010 and .NET 4 is now available.

Download and Install Today

MSDN subscribers, as well as WebsiteSpark/BizSpark/DreamSpark members, can now download the final releases of Visual Studio 2010 and TFS 2010 through the MSDN subscribers download center. 

If you are not an MSDN Subscriber, you can download free 90-day trial editions of Visual Studio 2010. 

Or you can can download the free Visual Studio express editions of Visual Web Developer 2010, Visual Basic 2010, Visual C# 2010 and Visual C++.  These express editions are available completely for free (and never time out).  If you are looking for an easy way to setup a new machine for web-development you can automate installing ASP.NET 4, ASP.NET MVC 2, IIS, SQL Server Express and Visual Web Developer 2010 Express really quickly with the Microsoft Web Platform Installer (just click the install button on the page).

What is new with VS 2010 and .NET 4

Today’s release is a big one – and brings with it a ton of new feature and capabilities.

One of the things we tried hard to focus on with this release was to invest heavily in making existing applications, projects and developer experiences better.  What this means is that you don’t need to read 1000+ page books or spend time learning major new concepts in order to take advantage of the release.  There are literally thousands of improvements (both big and small) that make you more productive and successful without having to learn big new concepts in order to start using them. 

Below is just a small sampling of some of the improvements with this release:

Visual Studio 2010 IDE 

Visual Studio 2010 now supports multiple-monitors (enabling much better use of screen real-estate).  It has new code Intellisense support that makes it easier to find and use classes and methods. It has improved code navigation support for searching code-bases and seeing how code is called and used.  It has new code visualization support that allows you to see the relationships across projects and classes within projects, as well as to automatically generate sequence diagrams to chart execution flow. 

The editor now supports HTML and JavaScript snippet support as well as improved JavaScript intellisense. The VS 2010 Debugger and Profiling support is now much, much richer and enables new features like Intellitrace (aka Historical Debugging), debugging of Crash/Dump files, and better parallel debugging.  VS 2010’s multi-targeting support is now much richer, and enables you to use VS 2010 to target .NET 2, .NET 3, .NET 3.5 and .NET 4 applications.  And the infamous Add Reference dialog now loads much faster.

TFS 2010 is now easy to setup (you can now install the server in under 10 minutes) and enables great source-control, bug/work-item tracking, and continuous integration support.  Testing support (both automated and manual) is now much, much richer.  And VS 2010 Premium and Ultimate provide much better architecture and design tooling support.

VB and C# Language Features

VB and C# in VS 2010 both contain a bunch of new features and capabilities.  VB adds new support for automatic properties, collection initializers, and implicit line continuation support among many other features.  C# adds support for optional parameters and named arguments, a new dynamic keyword, co-variance and contra-variance, and among many other features.

ASP.NET 4 and ASP.NET MVC 2

With ASP.NET 4, Web Forms controls now render clean, semantically correct, and CSS friendly HTML markup. Built-in URL routing functionality allows you to expose clean, search engine friendly, URLs and increase the traffic to your Website.  ViewState within applications can now be more easily controlled and made smaller. Client IDs rendered by server controls can now be controlled.  ASP.NET Dynamic Data support has been enhanced.  More controls, including rich charting and data controls, are now built-into ASP.NET 4 and enable you to build applications even faster.  New starter project templates now make it easier to get going with new projects.  SEO enhancements make it easier to drive traffic to your public facing sites.  And web.config files are now clean and simple.

ASP.NET MVC 2 is now built-into VS 2010 and ASP.NET 4, and provides a great way to build web sites and applications using a model-view-controller based pattern. ASP.NET MVC 2 adds features to easily enable client and server validation logic, provides new strongly-typed HTML and UI-scaffolding helper methods.  It also enables more modular/reusable applications.  The new <%: %> syntax in ASP.NET makes it easier to HTML encode output.  Visual Studio 2010 also now includes better tooling support for unit testing and TDD.  In particular, “Consume first intellisense” and “generate from usage" support within VS 2010 make it easier to write your unit tests first, and then drive your implementation from them.

Deploying ASP.NET applications gets a lot easier with this release. You can now publish your Websites and applications to a staging or production server from within Visual Studio itself. Visual Studio 2010 makes it easy to transfer all your files, code, configuration, database schema and data in one complete package. VS 2010 also makes it easy to manage separate web.config configuration files settings depending upon whether you are in debug, release, staging or production modes.

WPF 4 and Silverlight 4

WPF 4 includes a ton of new improvements and capabilities including more built-in controls, richer graphics features (cached composition, pixel shader 3 support, layoutrounding, and animation easing functions), a much improved text stack (with crisper text rendering, custom dictionary support, and selection and caret brush options).  WPF 4 also includes a bunch of support to enable you to take advantage of new Windows 7 features – including multi-touch and Windows 7 shell integration.

Silverlight 4 will launch this week as well.  You can watch my Silverlight 4 launch keynote streamed live Tuesday (April 13th) at 8am Pacific Time.  Silverlight 4 includes a ton of new capabilities – including a bunch for making it possible to build great business applications and out of the browser applications.  I’ll be doing a separate blog post later this week (once it is live on the web) that talks more about its capabilities.

Visual Studio 2010 now includes great tooling support for both WPF and Silverlight.  The new VS 2010 WPF and Silverlight designer makes it much easier to build client applications as well as build great line of business solutions, as well as integrate and bind with data.  Tooling support for Silverlight 4 with the final release of Visual Studio 2010 will be available when Silverlight 4 releases to the web this week.

SharePoint and Azure

Visual Studio 2010 now includes built-in support for building SharePoint applications.  You can now create, edit, build, and debug SharePoint applications directly within Visual Studio 2010.  You can also now use SharePoint with TFS 2010.

Support for creating Azure-hosted applications is also now included with VS 2010 – allowing you to build ASP.NET and WCF based applications and host them within the cloud.

Data Access

Data access has a lot of improvements coming to it with .NET 4.  Entity Framework 4 includes a ton of new features and capabilities – including support for model first and POCO development, default support for lazy loading, built-in support for pluralization/singularization of table/property names within the VS 2010 designer, full support for all the LINQ operators, the ability to optionally expose foreign keys on model objects (useful for some stateless web scenarios), disconnected API support to better handle N-Tier and stateless web scenarios, and T4 template customization support within VS 2010 to allow you to customize and automate how code is generated for you by the data designer. 

In addition to improvements with the Entity Framework, LINQ to SQL with .NET 4 also includes a bunch of nice improvements. 

WCF and Workflow

WCF includes a bunch of great new capabilities – including better REST, activation and configuration support.  WCF Data Services (formerly known as Astoria) and WCF RIA Services also now enable you to easily expose and work with data from remote clients.

Windows Workflow is now much faster, includes flowchart services, and now makes it easier to make custom services than before.  More details can be found here.

CLR and Core .NET Library Improvements

.NET 4 includes the new CLR 4 engine – which includes a lot of nice performance and feature improvements.  CLR 4 engine now runs side-by-side in-process with older versions of the CLR – allowing you to use two different versions of .NET within the same process.  It also includes improved COM interop support. 

The .NET 4 base class libraries (BCL) include a bunch of nice additions and refinements.  In particular, the .NET 4 BCL now includes new parallel programming support that makes it much easier to build applications that take advantage of multiple CPUs and cores on a computer.  This work dove-tails nicely with the new VS 2010 parallel debugger (making it much easier to debug parallel applications), as well as the new F# functional language support now included in the VS 2010 IDE.  .NET 4 also now also has the Dynamic Language Runtime (DLR) library built-in – which makes it easier to use dynamic language functionality with .NET.  MEF – a really cool library that enables rich extensibility – is also now built-into .NET 4 and included as part of the base class libraries. 

.NET 4 Client Profile

The download size of the .NET 4 redist is now much smaller than it was before (the x86 full .NET 4 package is about 36MB).  We also now have a .NET 4 Client Profile package which is a pure sub-set of the full .NET that can be used to streamline client application installs.

Visual C++

VS 2010 includes a bunch of great improvements for C++ development.  This includes better C++ Intellisense support, MSBuild support for projects, improved parallel debugging and profiler support, MFC improvements, and a number of language features and compiler optimizations.

My VS 2010 and .NET 4 Blog Series

I’ve been cranking away on a blog series the last few months that highlights many of the new VS 2010 and .NET 4 improvements.  The good news is that I have about 20 in-depth posts already written.  The bad news (for me) is that I have about 200 more to go until I’m done!  I’m going to try and keep adding a few more each week over the next few months to discuss the new improvements and how best to take advantage of them.

Below is a list of the already written ones that you can check out today:

Stay tuned to my blog as I post more.  Also check out this page which links to a bunch of great articles and videos done by others.

VS 2010 Installation Notes

If you have installed a previous version of VS 2010 on your machine (either the beta or the RC) you must first uninstall it before installing the final VS 2010 release.  I also recommend uninstalling .NET 4 betas (including both the client and full .NET 4 installs) as well as the other installs that come with VS 2010 (e.g. ASP.NET MVC 2 preview builds, etc).  The uninstalls of the betas/RCs will clean up all the old state on your machine – after which you can install the final VS 2010 version and should have everything just work (this is what I’ve done on all of my machines and I haven’t had any problems).

The VS 2010 and .NET 4 installs add a bunch of new managed assemblies to your machine.  Some of these will be “NGEN’d” to native code during the actual install process (making them run fast).  To avoid adding too much time to VS setup, though, we don’t NGEN all assemblies immediately – and instead will NGEN the rest in the background when your machine is idle.  Until it finishes NGENing the assemblies they will be JIT’d to native code the first time they are used in a process – which for large assemblies can sometimes cause a slight performance hit.

If you run into this you can manually force all assemblies to be NGEN’d to native code immediately (and not just wait till the machine is idle) by launching the Visual Studio command line prompt from the Windows Start Menu (Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio Command Prompt).  Within the command prompt type “Ngen executequeueditems” – this will cause everything to be NGEN’d immediately.

How to Buy Visual Studio 2010

You can can download and use the free Visual Studio express editions of Visual Web Developer 2010, Visual Basic 2010, Visual C# 2010 and Visual C++.  These express editions are available completely for free (and never time out).

You can buy a new copy of VS 2010 Professional that includes a 1 year subscription to MSDN Essentials for $799.  MSDN Essentials includes a developer license of Windows 7 Ultimate, Windows Server 2008 R2 Enterprise, SQL Server 2008 DataCenter R2, and 20 hours of Azure hosting time.  Subscribers also have access to MSDN’s Online Concierge, and Priority Support in MSDN Forums.

Upgrade prices from previous releases of Visual Studio are also available.  Existing Visual Studio 2005/2008 Standard customers can upgrade to Visual Studio 2010 Professional for a special $299 retail price until October.  You can take advantage of this VS Standard to Professional upgrade promotion here.

Web developers who build applications for others, and who are either independent developers or who work for companies with less than 10 employees, can also optionally take advantage of the Microsoft WebSiteSpark program.  This program gives you three copies of Visual Studio 2010 Professional, 1 copy of Expression Studio, and 4 CPU licenses of both Windows 2008 R2 Web Server and SQL 2008 Web Edition that you can use to both develop and deploy applications with at no cost for 3 years.  At the end of the 3 years there is no obligation to buy anything.  You can sign-up for WebSiteSpark today in under 5 minutes – and immediately have access to the products to download.

Summary

Today’s release is a big one – and has a bunch of improvements for pretty much every developer.  Thank you everyone who provided feedback, suggestions and reported bugs throughout the development process – we couldn’t have delivered it without you. 

Hope this helps,

Scott

P.S. In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu

Attention all Teched India 2010 attendees!

Attention all Teched India 2010 attendees!

You will find an important paper in your orange attendee bag that you received during registration yesterday. It contains a special offer from Pluralsight & Infragistics:

The offer is for a free 1-month subscription to our Pluralsight On-Demand! .NET training library. This gives you enough time to complete 1 or 2 .NET training courses. However, in order to take advantage of the offer, you have to register for the offer by April 18th, this Sunday! If you wait until after April 18th, the code will still be good for another 2 months, but it will only give you a free 1-week pass to the library.

When talking to attendees at our booth yesterday, it was clear that most attendees hadn’t seen the paper or the offer, so we wanted to make everyone knows about it, and that you don’t throw the paper away. 😉

Come see us at the booth today if you need another copy of the offer. Also, Pluralsight & Infragistics will be raffling off some prizes today and tomorrow (at the end of the exhibit time). Check in with us today for details.

Hope you’re enjoying Teched India 2010!

Announcing commercial availability of Windows Azure platform AppFabric

Earlier in March, we informed you about the upcoming commercial availability of Windows Azure platform AppFabric. Today, we are absolutely thrilled to let you know that AppFabric has now become a fully SLA-supported paid service. Customers using AppFabric will see billing information in their accounts, as usage charges have begun accruing as of 11:00 PM (UTC) on April 12, 2010.

 

Windows Azure platform AppFabric includes Service Bus and Access Control services. AppFabric Service Bus connects services and applications across network boundaries to help developers build distributed applications. AppFabric Access Control provides federated, claims-based access control for REST web services.

 

You can find pricing for AppFabric here.   You can also go to the pricing section of our FAQs for additional information as well as our AppFabric pricing blog post. If you do not wish to be charged for AppFabric, please discontinue use of these services.

 

Also, we are happy to let you know that the Microsoft Windows Azure Platform, including Windows Azure, SQL Azure, and Windows Azure platform AppFabric has expanded general availability to an additional 20 countries, making our flexible cloud services platform available to a global customer base and partner ecosystem across 41 countries. Details about this announcement are available here.

 

Thank you for your business and your continued interest in AppFabric.

 

The Windows Azure platform AppFabric Team

Using dynamic objects in Silverlight 4

Note: This blog post is written using Silverlight 4.0 RC 1

One of the cool new features in Silverlight 4 is the ability to data bind to indexed properties. This means that even if you don’t know at design time what properties you data object has you can still data bind to them.

The syntax is very similar to a normal data binding, only in this case you need to use the [key] syntax instead. For example in example below the FirstName is a regular property while the LastName below is an indexed property.

<StackPanel Name="LayoutRoot">
    <StackPanel Orientation="Horizontal" Margin="1">
        <TextBlock Text="FirstName" Width="150"></TextBlock>
        <TextBox Text="{Binding FirstName, Mode=TwoWay}" Width="500"></TextBox>
    </StackPanel>
    <StackPanel Orientation="Horizontal" Margin="1">
        <TextBlock Text="LastName" Width="150"></TextBlock>
        <TextBox Text="{Binding [LastName], Mode=TwoWay}" Width="500"></TextBox>
    </StackPanel>
</StackPanel>

 

Creating the class to data bind to is simple. All you need to do is add a property with the following syntax:

public object this[string key]
    { get; set; }

 

In this example I am using a Peron class with a regular FirstName property and all others are dong using indexed properties. The complete class, including INotifyPropertyChanged looks like this:

public class Person : INotifyPropertyChanged
{
    public Person()
    {
        PropertyChanged = (s, e) => { };
 
        FirstName = "Maurice";
        this["LastName"] = "de Beijer";
        this["BabyName"] = "Kai";
    }
 
    private Dictionary<string, object> _data = new Dictionary<string, object>();
    public object this[string key]
    {
        get
        {
            if (!_data.ContainsKey(key))
                _data[key] = null;
 
            return _data[key];
        }
        set
        {
            _data[key] = value;
            PropertyChanged(this, new PropertyChangedEventArgs(""));
        }
    }
 
    public IEnumerable<string> Keys
    {
        get
        {
            return _data.Keys;
        }
    }
 
    private string _firstName;
    public string FirstName
    {
        get
        {
            return _firstName;
        }
        set
        {
            _firstName = value;
            PropertyChanged(this, new PropertyChangedEventArgs("FirstName"));
        }
    }
 
    public event PropertyChangedEventHandler PropertyChanged;
}

 

While not having to know the objects structure at design time is nice but in the XAML above I still hard coded the data bindings so that doesn’t buy us much yet. So fully utilize this we need to dynamically generate the UI as well. Fortunately that is quite easy to do with the following code:

void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    var person = new Person();
    DataContext = person;
 
    foreach (var item in person.Keys)
    {
        var lbl = new TextBlock();
        lbl.Text = item;
        lbl.Width = 150;
 
        var txt = new TextBox();
        var binding = new Binding("[" + item + "]");
        binding.Mode = BindingMode.TwoWay;
        txt.SetBinding(TextBox.TextProperty, binding);
        txt.Width = 500;
 
        var line = new StackPanel();
        line.Orientation = Orientation.Horizontal;
        line.Children.Add(lbl);
        line.Children.Add(txt);
        line.Margin = new Thickness(1);
        LayoutRoot.Children.Add(line);
    }
}

And the result looks like this. The LastName is printed twice because it is both hard coded into the XAML and added dynamically.

 

A few gotchas I ran into.

While doing this I experimented with using a Dictionary<string, object> as the DataContext itself. That worked file except for the part that this doesn’t implement INotifyPropertyChanged. So i tried to create a Peron class deriving from Dictionary<string, object> and adding a indexer to that but this doesn’t work, data binding completely fails to load the data. The same was try for my own implementation of IDictionary<string, object>.

Another thing was the property name that is used with the INotifyPropertyChanged.PropertyChanged event. It seems using an empty string as the property name is the only thing that works to get other controls to update their binding. Not a big issue but I caught me at first.

 

Enjoy!

www.TheProblemSolver.nl

Wiki.WindowsWorkflowFoundation.eu

Use code blocks to extend your BizTalk custom XSLT maps

Update 2010-04-13: Grant Samuels commented and made me aware of the fact that inline scripts might in some cases cause memory leaks. He has some further information here and you’ll find a kb-article here.

I’ve posted a few times before on how powerful I think it is in complex mapping to be able to replace the BizTalk Mapper with a custom XSLT script (here’s how to.aspx)). The BizTalk Mapper is nice and productive in simpler scenarios but in my experience it break down in more complex ones and maintaining a good overview is hard. I’m however looking forward to the new version of the tool in BizTalk 2010 – but until then I’m using custom XSLT when things gets complicated.

Custom XSLT however lacks a few things once has gotten used to have – such as scripting blocks, clever functoids etc. In some previously post (here and here) I’ve talked about using EXSLT as a way to extend the capabilities of custom XSLT when used in BizTalk.

Bye, bye external libraries – heeeello inline scripts 😉

Another way to achieve much of the same functionality even easier is to use embedded scripting that’s supported by the XslTransform class. Using a script block in XSLT is easy and is also the way the BizTalk Mapper makes it possible to include C# snippets right into your maps.

Have a look at the following XSLT sample:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:code="http://richardhallgren.com/Sample/XsltCode"
    exclude-result-prefixes="msxsl code"
    >
    <xsl:output method="xml" indent="yes"/>

    <xsl:template match="@* | node()">
        <Test>
            <UniqueNumber>
                <xsl:value-of select="code:GetUniqueId()" />
            </UniqueNumber>
            <SpecialDateFormat>
                <xsl:value-of select="code:GetInternationalDateFormat('11/16/2003')" />
            </SpecialDateFormat>
            <IncludesBizTalk>
                <xsl:value-of select="code:IncludesSpecialWord('This is a text with BizTalk in it', 'BizTalk')" />
            </IncludesBizTalk>
        </Test>
    </xsl:template>

    <msxsl:script language="CSharp" implements-prefix="code">
        //Gets a unique id based on a guid
        public string GetUniqueId()
        {
            return Guid.NewGuid().ToString();
        }

        //Formats US based dates to standard international
        public string GetInternationalDateFormat(String date)
        {
            return DateTime.Parse(date, new System.Globalization.CultureInfo("en-US")).ToString("yyyy-MM-dd");
        }

        //Use regular expression to look for a pattern in a string
        public bool IncludesSpecialWord(String s, String pattern)
        {
            Regex rx = new Regex(pattern);
            return rx.Match(s).Success;
        }
    </msxsl:script>
</xsl:stylesheet>

All one has to do is to define a code block, reference the xml-namespace used and start coding! Say goodbye to all those external library dlls!

It’s possible to use a few core namespaces without the full .NET namespace path but all namespaces are available as long as they are fully qualified. MSDN has a great page with all the details here.aspx).

Regional Pluralsight On-Demand! pricing for India customers

Regional Pluralsight On-Demand! pricing for India customers

We are very excited to announce our latest Pluralsight On-Demand! feature for customers located within India – regional pricing and delivery! Ultimately, this means India-based developers will benefit from a more cost-effective pricing option to access Pluralsight On-Demand! training from within the India region. We are launching the beta program for this regional model during TechEd India 2010, the Visual Studio 2010 Global Launch event held in Bangalore, India this week.

As part of that beta program, all TechEd India 2010 attendees are eligible to receive a free 1-month subscription to Pluralsight On-Demand, no strings attached. Look for the Pluralsight activation code within your attendee materials and activate by April 18, 2010. If you activate after April 18th, the code will give you a free 1-week subscription.

In addition to regional pricing, Pluralsight On-Demand! also now takes advantage of a worldwide content distribution network for regional delivery of our training videos. This new feature will ultimately help our customers all over the world receive the best possible performance including those customers located in the India region (more details here)

I am personally onsite in Bangalore this week for this exciting announcement. I’m looking forward to engaging with our India customers during the event and hope to learn more about their needs this market. If you’re attending TechEd India 2010 this week, come visit me at the Pluralsight/Infragistics booth and say hello. I will be there throughout the show. I’d love the opportunity to talk to you about what you look for in training, and what we can do to make the Pluralsight experience better for you in India. You can follow me on Twitter throughout the week on @skonnard.

Also, if you’re a Microsoft MVP, RD, or local User Group leader in India, be sure to come by the booth and introduce yourself to me. I have something special to give you for helping improve the Microsoft developer community!

You can read the full Pluralsight press release here.

Happy learning.

Pluralsight On-Demand! worldwide content distribution

Pluralsight On-Demand! worldwide content distribution

We’re excited to announce that Pluralsight On-Demand! now takes advantage of a worldwide content distribution network to deliver our training videos to customers all over the world. This ultimately helps our customers receive the best possible user experience when accessing our training library from locations far from our central servers.

When accessing a video through the Pluralsight On-Demand! website, the request is now routed to the nearest edge-caching server. If that cache location doesn't yet have a copy of that particular video, it requests it from the central servers and immediately begins streaming it to you, caching the video as it goes. If your local cache location already has the video, you'll get it served from the cache location immediately, which is typically much closer than our central servers, depending on where you are located. Hence, as Pluralsight On-Demand! usage grows, subscribers will continue to see the best possible performance when accessing the videos from our library.

Our 14 edge caching servers are located all around the world in the following major cities; Ashburn, VA, Dallas/Fort Worth, TX, Los Angeles, CA, Miami, FL, Newark, NJ, Palo Alto, CA, Seattle, WA, St. Louis, MO, Amsterdam, Dublin, Frankfurt, London, Singapore, Hong Kong and Tokyo. And there will be more coming in the future.

BizTalk Adapter Pack 2.0 – Part 3 Receiving multiple Flat File IDocs using SAP Adapter

BizTalk Adapter Pack 2.0 – Part 3 Receiving multiple Flat File IDocs using SAP Adapter

In Part 2 of this series we discussed how you can receive IDocs from SAP in flat file format in order to avoid tight coupling with the version of SAP you are running as discussed in Post 1.

As I alluded to in the end of the Part 2 post, there is an issue when you include more than 1 IDoc schema in a Receive Pipeline that will be use the same Program ID and Receive location.

The behavior that I experienced when working through this scenario is the first message in my pipeline would be processed successfully but the second type(Vacations) would not.

 

 image

 

When I tried to process my 2nd type of IDoc (Employee Vacations) I would get the following error:

 

Event Type:    Error
Event Source:    BizTalk Server 2009
Event Category:    (1)
Event ID:    5719
Date:        4/11/2010
Time:        10:10:49 AM
User:        N/A
Computer:    *BizTalk Server*

Description:
There was a failure executing the receive pipeline: "SAPVersions.ReceiveSAPIDocs, SAPVersions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=147585b889447deb" Source: "Flat file disassembler" Receive Port: "ReceiveIDocsFromSAP" URI: "sap://CLIENT=XX;LANG=EN;@a/SAPSERVER/XX?ListenerGwServ=sapgwXX&ListenerGwHost=SAPSERVERci&ListenerProgramId=*ProgramID*&RfcSdkTrace=False&AbapDebug=False" Reason: Unexpected data found while looking for:
‘Z2HR_WS_SEG000’
The current definition being parsed is idocData. The stream offset where the error occured is 520. The line number where the error occurred is 2. The column where the error occured is 0.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

 

In the rest of the post I will discuss how you can fix this problem manually and then discuss the Hot Fix from Microsoft that addresses this situation.  I recommend proceeding with the Hot Fix route as it is a more sustainable solution.  The manual steps include modifying a schema that was generated by the Consume Adapter Service Wizard.  The risk is you can manually modify one of these schemas only to have a colleague regenerate the schema and overwrite your manual change.  If you do proceed with the Hot Fix route you will want to ensure any other developers that will be generating IDoc schemas are also using this Hot Fix.  I also want to highlight that this Hot Fix should be applied to developer’s workstations as this fix addresses a design time issue.

 

Fixing issue manually

  • Open up your schema that contains the “meat” of your IDoc information in an XML Editor view.  Whenever you generate  SAP IDoc schemas you are bound to have multiple XSD schemas created.  You can expect 1 IDoc that includes the various complex types, another that acts as the “Request” container IDoc, a Response xsd and the “meat” xsd which will include most of the “core” details of the schema.
  • Scroll down until you find a section that includes tag_name=”EDI_DC40” tag_offset="0" and replace it with tag_name="ZHR_VAC" tag_offset="39" where “ZHR_WS” is the name of your IDoc type.

image

 

image

 

  • What you will find as you open your schemas is that all of them will have this tag_name="EDI_DC40" tag_offset="0" string included in the IDoc which prevents BizTalk from distinguishing one IDoc from another.
  • Once you have modified all IDocs in this fashion, redeploy and you should find that both(in my case) IDocs were processed successfully.

image

Fixing issue with HotFix

  • In KB977528 Microsoft describes the issue as “This problem occurs because the first Flat file disassembler pipeline component in the custom pipeline tries to disassemble all the IDOCs that are received. However, the IDOCs should be processed by different Flat file disassembler components that have different schemas”.

  • When using the HotFix, you download schemas the same way as you previously did

image

  • Note when you open up the schema, you will now notice that the same change that we applied manually has now been incorporated into the schema definition automatically.

image

  • If you have changed the name of you XSD files, make sure you update your receive pipeline, deploy and restart your host instance(s).  You should now be able to receive both types of flat file IDocs without issue

image

 

Note:

My developer workstation is a 64 bit machine so when I navigated to the Hot Fix Web site it detected that my system was a 64 bit system and provided me with a 64 bit patch.  The problem is that Visual Studio runs in 32 bit mode and since this fix is a design time issue my issue was not resolved until I downloaded the 32 bit version of this KB.  I logged onto a 32 bit machine and navigate to the same site in order to get the 32 bit fix.

 

image

 

Thus far we have been  focusing on receiving IDocs.  A reader has asked if I can demonstrate how to sent a flat file schema to SAP using the BizTalk Adapter Pack so that will be the next post in this series.