Wednesday, July 31, 2013

BTDF – Warning Assembly “……" depends on the following assemblies that must be installed in the Global Assembly Cache

This post hopefully helps when facing the aforementioned error while depkiying, buildingwith the btdf.

Problem
warning : Assembly “……" depends on the following assemblies that must be installed in the Global Assembly Cache
What is the dll we get the error on????? Follow the next step to get more info.
Cause
One or more of your projects have a reference to an Assembly, which has Copy ‘Local = false’. This causes the GacUtil called by MSBuild / BTDF to do it’s best to keep you busy.
image
 
Solution
Open ALL your projects, look in every refence for the ‘Copy Local’ and change it to True
image

Result
EXEC : warning : Assembly "<>.Orchestrations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<>" depends on the following assemblies that must be installed in the Global Assembly Cache for runtime to succeed:
  Assembly "Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  Assembly 



HTH,
Sander

Sunday, July 28, 2013

BizTalk Solution Analyzer

  The tool BizTalk Solution Analyzer allows you to analyse a BizTalk project and uses various rules to generate a report which contains information about your implementation, stored in a database so that you can do additional querying on it. It is also a perfect tool to be included in your build as it provides tasks to be included in MSBuild. This tool was created by Michael Stephenson and is packed with functionality. To use the tool, you need to;
  • Create a new database
image
  • Name it AppFx.SolutionAnalyser
clip_image005
  • Import the scripts provided with the solution
image
 
  • Open AppFx.SolutionAnalyser (and change the settings where needed)
clip_image002
clip_image008
  • The settings can be saved, and retrieved
clip_image010
  • Explicitly define the output path by typing in the path (e.g. C:\BizTalk\Settings.Xml)
clip_image012

  • The analysis should complete (if not, see the section below)
clip_image014
  • And a report Html file is generated
image
  • Which contains all the statistics
image
  • The tool additionally provides reports which can be found at the ‘Solutions’ menu bar
clip_image016
Note: It would be great if all reports would be opened after the report is completed, and even better if all the reports are shown in a single window (e.g. with a tab control)
  • The reports are great help, the most useful to my opinion is the Complexity overview!
clip_image018

clip_image020
  • Error while generating report
I did run into an error while generating the report, this error was related to the checkbox ‘SaveToDatabase=true’ (see this workitem)
clip_image022

This can be solved by changing the BaseFile.cs with the following minor change;
clip_image024

Nevertheless, a great addition to my tool belt

HTH,
Sander








Wednesday, July 24, 2013

XLang – Debugging BizTalk from within VS.Net


When developing Orchestrations, you are using a visual designer, which will in effect generate XLang which is handled by the BizTalk Xlang engine.
Although the Xlang engine has its own language XLang, it does support some shapes (Expression shapes, Delay) which are compatible with C#. It’s also possible to call .Net assemblies from an Atomic scope, and debug these following the steps; described in this post: Debugging .Net):
  • Build the external C# library project
  • Add it to the GAC
  • Restart the Host Instance
  • Attach the debugger to the Host instance
All great stuff, additionally, you can use the Orchestration debugger (Orchestration debugger) which connects to the XLang scheduler, all fine and dandy.
When you however, have an orchestration that directly fails, with an error you cannot comprehend, or tracking is disabled, you’re not so happy. Tracking is performed at the persistence points (Persistence points).
clip_image001[6]
An Expression shape (which does not lead to a persistence point), which leads to a failure…
 
clip_image003[4]
Does not result in an Error that helps a lot…
InstanceId: de8b3be2-48a3-493d-8dcb-c0b3c1a848fc
Shape name: Construct Routing and Resolutoin Fault Message
ShapeId: a42fb879-c074-455b-9c4c-a4e98b5632a5
Exception thrown from: segment 5, progress 3
Inner exception: Object reference not set to an instance of an object.
 
I want to show, that you can also look deeper than this, however it does requires you to understand, work with the XLang that is generated based on your designer…which might not be that easy to understand.
The Xlang is not C#, there a good post on this Xlang vs C#, it is generated. Below a short sample of XLAng;
               if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 4;
            case 4:
                System.Diagnostics.Debug.WriteLine("test");
                if ( !PostProgressInc( __seg__, __ctx__, 5 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 5;
            case 5:
                if ( !PreProgressInc( __seg__, __ctx__, 6 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[7],__eventData[4],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 6;
            case 6:
 
When building a file, the XLang that is generated is located on the following location;
<ProjectName>.Orchestrations\obj\Debug\BizTalk\XLang\File0.cs


If you open this file….it looks you like can set breakpoints, off course, it’s C#, but then a little different. We can now go to our shape;
clip_image001[7]
Consider Xpath which might be incorrect;
clip_image005[4]

 
And look at the generated source;
image
Doesn’t that look simple….? let’s debug this…
As we have the C# file, and can look at the generated code, we would like to do more, we can attach to this (so directly from Visual Studio) using the following steps;
·         Build the Orchestration project
·         Add it to the GAC
·         Open the File0.cs
·         Set a breakpoint
·         Restart the Host instances
·         Attach the debugger (with the File0.CS) open to the Host Instance process
 
Sending a message leads to an exception which we have seen;

clip_image010[4]

 
However, we can perform debugging by inspecting the message using the QuickWatch, change the XPath;
 
clip_image011[4]
We can also look at the result of the XPath;
clip_image013[4]
 
So that was the problem? The Xpath query I used was wrong;
QUERY:  /*[local-name()='Order']/*[local-name()='OrderHeader']/*[local-name()='Id']
clip_image015[4]

RESULT:
The Xpath query needs to be wrapping in a string to return the Value (something you might know, but sometimes forget L);
CHANGE:QUERY:  string(/*[local-name()='Order']/*[local-name()='OrderHeader']/*[local-name()='Id'])
 
RESULT:
clip_image017[4]
 
So yet, another way to figure out stuff, with the minimal of effort required such as deploying the solution, using the Orchestration debugger, attaching. This could be helpful when trying to understand the exception and cause of the exception. For instance when using:
·         XPath assignments (http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2004/10/25/using-xpath-inside-biztalk-orchestrations.aspx#sthash.npqIcFHH.dpbs)
·         Inline C# code
·         Initializing of variables
 
It’s in any case….really cool to look at the generated code, understand the XLang engine. This was done on a BizTalk 2013 engine, I’m sure it works in all previous versions.
 
 
HTH,
Sander
Tags van Technorati: ,,

Saturday, July 20, 2013

Scaling ...how they did it...how you can do it


One of the best tech-ed sessions in 2013 was from Haishi Bai who was discussing Patterns & Practices for Composing Cloud Services and was explaining a design pattern he was working on;

As of now he is posting details on his pattern, and builds on concepts that already are highly recommended, but combined with cloud technologies allows you to prepare your applications for the future;

VVM - Part1
VVM - Part2

One of the key components is that you should prepare for scale (scale-up, scale-out). As some companies already faced that challenge, i’ve posted some links where you can find their approach and experiences;

NetFlix
http://advance.blackducksoftware.com/content/WRNetflix

DropBox
http://techcrunch.com/2013/07/11/how-did-dropbox-scale-to-175m-users-a-former-engineer-details-the-early-days/

Facebook
https://www.facebook.com/note.php?note_id=409881258919

Kind regards,


Sander
Tags van Technorati: ,,

Friday, July 19, 2013

BizTalk maps – problem solving scenarios


If we consider the BizTalk architecture;
image
from the 'BizTalk Server: Presentations Gallery' We can see that there are 3 possible places where your maps are executed (in classic BizTalk);
  • Inbound (on the receive port)
  • Outbound (on the send port)
  • Business Process (within an orchestration)
So if there any problems, which approach should we follow, which options do we have…I hope to answer this in the following section, and these are things to think about, it’s not enforced, or defined in a book, it just a good thing, to be aware of your options and have a strategy. Solving an BizTalk map issue in a live environment;
  • We have an issue, we know it is in the map (analysis of the exception, output)
  • We let the team from ‘fixoursystem-land’ solve the issue in their dev, they test it before usage
  • We deploy it to the test environment, they test it before usage (deployed by a dev/admin)
  • We deploy it to the critical/live environment….(deployed by an admin)
  • We need to ensure that the correct version is deployed….how?
At this point, we don’t know if the referenced schemas, maps, are still aligned. The developer might have build against a different version of the schema, that change has gone through test etc. Although this should not happen because of version control, change management procedures, but if it comes to ‘critical issues’ these steps are often ignored!
Let’s consider the options that we have in this scenario, can we do a test without visual studio?

DEV ACC PROD
Visual Studio allowed Yes No No
Risk of corrupting a system when running tests Low High Unacceptable
Testing maps possible without live environment Yes No No

So basically no way, without possibly changing the connected systems! Considering each environment, we typically have the following options are available…  
DEV
·         Testing maps using inbound/outbound/within an orchestration
o   Visual Studio
o   Live on the BizTalk environment by submitting messages
o   Single part, supported by ‘Test map’
·         Requirements
o   Visual Studio
o   Live environment (low risk of corrupting a system)
·         Drawbacks
o   Multi part are only supported by manually creating a message using ‘Test map’, ‘Generate instance’ per schema, copy paste required structures
TEST
·         Testing maps using inbound/outbound/within an orchestration
o   Visual Studio (not recommended having this on this environment, but possible)
o   Live on the BizTalk environment by submitting messages (low risk of corrupting a system)
·         Requirements
o   Visual Studio
o   Live environment (medium risk of mutating external systems, backup is probably available, data can be removed)
o   Alternative: Retrieve dll from the GAC and run it on the DEV environment (risk of version conflicts)
·         Drawbacks
o   Timeconsuming
o   Risk of errors
ACC/PROD:
·         Single part message
o   Visual Studio (not recommended having this on this environment, but possible)
o   Live on the BizTalk environment by submitting messages (low risk of corrupting a system)
·         Multi part message
o   Manually, by creating messages on a DEV environment (low risk of corrupting a system as TEST is)
·         Requirements
o   Visual Studio
o   Live environment (high risk of mutating external systems, backup is probably not available, data cannot be removed)
o   Alternative: Retrieve dll from the GAC and run it on the DEV environment (risk of version conflicts)
·         Drawbacks
o   Timeconsuming
o   Risk of manual errors
 
Just for these situations, where you need more than the standard offering provides, go where no man has gone before, there is a tool (without any warranty), which enables you to do a lot more. This tool is called the ‘Map Test tool’ developed by Tomasso Groenendijk. This enables the following scenarios:
·         Test maps which are not yet deployed (so basically, only test the dll)
·         Test maps which are deployed
·         Test Multipart maps (using a wizard)
So not saying you should, but now you could ensure that a fix has been applied correctly, even on an environment without Visual Studio installed.
Using the tool
Follow the next steps to test a map with real data from multiple input messages:
Click in the File menu on the menu item “Create envelope with multiple input messages”.
CreateEnvelope
 
In the Wizard pop-up click on the “Add File” button to select a XML file to add to the envelope. You can select multiple input messages. Click on “Finish” to create the envelope.
MultipleInputMessagesWizard
 
Enter the filename of the envelope in the “Save As” pop-up and click on the “Save” button.
SaveAs
 
Enter the fully qualified name of the map and click on the “Test Map” button to test the map.
BizTalk2013_MapTester_SourceFile
 
In the Result tab is the transformed message shown. In the Info screen is the execution time shown and the name of the transformed file.
BizTalk2013_MapTester_TransformedFile
 
 
Even though this tool was already very sophisticated, I couldn’t stand having to manually go ahead and look up the Fully qualified name, so I made a minor contribution ‘AssemblyPicker’ which lets you select the map from the GAC.
 clip_image006
You can select all the maps residing inside an assembly and pick the map you need;
clip_image007
 
 
Note: As I also use the ESB Rule tester quite often, I also added a ‘Policy Picker’, which should be included in the new version as well :)
clip_image009

HTH,

Sander
Tags van Technorati: ,