Wednesday, 12 December 2012

Problem with Environment.SpecialFolder.ApplicationData in Azure

While I was testing the TeamCity auto deployment from Git to Azure, I hit on an weird bug where TeamMentor's website would look (and load) OK in AppHarbor, but would fail in Azure.


Here is the error I got in Azure:

image

After some research, debug and multiple-git-commits with auto-deployment, I found that the error was on the .ctor of the FluentSharp.CoreLib.dll KO2Config class, which was trying to use the Environment.SpecialFolder.ApplicationData value in a Path.Combine. 

Since in Azure, that (Environment.SpecialFolder.ApplicationData) value is null, the exception shown above happened (ironically this would had been prevented if the FluentSharp’s own pathCombine Extension Method had been used, since that method can handle null values or either parameters).

In order to debug this I created a number of Git Commits (auto deployed in less than 30s to the live Azure site via TeamCity) and this is the screenshot that gave me clue about the LocalApplicationData value.

Compare this version from Azure

image

with the same code based running in AppHarbor:

image

(the prob is in the 2nd and 3rd lines where in Azure those values are empty).

After the fix was pushed (via NuGet) TeamMentor was back in action :)

image
Post a Comment