Sunday, 26 January 2014

Retrospective - Umbraco 6.0.6 mono port

This port constituted an interesting exercise, and while being simple in principle, proved to be quite complex in implementation.
The primary difficulties faced were those involving casing of file names, and differences between the mono and MS flavours of .NET.

On the plus side, a quick overview of the major issues can be seen in 'Umbraco.Core/MultiPlatform', where I attempted to segregate the issues faced during the port, and demonstrated some possible solutions.

Additionally, Umbraco 6.0.6 has started using some Async calls in the handling of document types, and the implementation of async calls in my version of mono was not yet mature. As a result of this, working with document types requires great care, and I found it best to use the left side tree view to refresh the selected document type view.

Another difficulty is the recycling of the app when the web.config file changes. This also does not always behave as anticipated.

I have enjoyed working on this project, and hope that it will provide some interest and benefit to the community.

Umbraco 6.0.6 mono port project concluded

The final release version is available here: here


To build:



  • Checkout from github here

  • Minimum - Mono: 3.0.6 (#20e40c4), xsp: 3.0.0.0 (#4587438) - both available here

  • Nuget, see here


Update BASE path then execute.


tools/Mono/RestoreNugetPackages.sh

Run this twice. It will error on first run, and should complete on the second.


build/build.sh [Debug (Default) | Release]

Sample deployment files and binaries

are here


Install notes



  • During install, after web.config is altered, you may get a blank screen. Simply reload the page.

  • During database install, after web.config is altered, the page may hang with the progress bat at 5%. Simply reload the page.

  • When install is finished, you get a blank page and reloading does not help. Remove 'install?...' from the url and press enter.

  • May need to verify file directory permissions after install

  • 'http://.../umbraco/logout.aspx?redir=%2fumbraco%2fumbraco.aspx' System Null Reference Exception. Clear cookies.

  • Default install is configured for Mvc


Application Notes:



  • I have not vetted all of the Data Types, and have not tested the web forms version in this release.


Please read the 'Retrospective' article before deploying to production environments.

Tuesday, 22 October 2013

web.config name casing issue fixed

OK, after some teething pains, the new box is up and running, and I have fixed the web.config casing issue - the one where Umbraco was expecting a lower cased name, however, where mono would accept web.config or Web.config.


Of course, this issue would never have hit file systems that are case insensitive (e.g. default windows installations). But in our case, it created issues: when the web configuration file was called 'Web.config', Umbraco has difficulty finding it, and also re-generated 'web'.config' files in the Views folder.


So I wrote some code so that if we do not find 'web.config', we look for 'Web.config', and then if that is not found as well, we either re-generate, or throw an error.


On another note, on the new box, I could not get the monodevelop NUnit plugin to work. It runs for exactly 170 tests and then the UI crashes. I suspect a glibc compatibility issue. But to stay on track, I ll ignore this for the time being. I was able to run tests with the NUnit 2.6.3 gui application.

Sunday, 13 October 2013

New Linux box is up

Yes, the new Linux box is finally up and I have set up the parallel mono development environment as well for mono 3.0.11. I am ready to sort out the casing issue that affected the web.config file.


Setting up the new system required that I re-set up NuGet. I do not think I have discussed this before. This is discussed in detail here. To briefly summarise (assuming /opt/mono as install location),



$ mkdir /opt/mono/local
$ mkdir /opt/mono/local/bin
$ mkdir /opt/mono/local/bin/NuGet
$ cd /opt/mono/local/bin/NuGet
$ wget http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=nuget&DownloadId=741331&FileTime=130256444329670000&Build=20798
$ cd /opt/mono/bin

$ nano -w nuget

(add the below and save)
#!/bin/sh
exec mono --runtime=v4.0.30319 --gc=sgen /opt/mono/local/bin/NuGet/NuGet.exe "$@"


There is also a really bizarre issue with the Monodevelop parser, and it can get confused parsing .aspx files. The quick hacky solution is to add a variable (control) declaration to the designer.cs file:



src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKitDesigns.ascx.designer.cs View file @ 102a3fe
@@ -2,5 +2,6 @@

public partial class LoadStarterKitDesigns {
+ protected global::System.Web.UI.WebControls.Panel pl_CustomizeSkin;
}
}

(based on)
<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="LoadStarterKitDesigns.ascx.cs" Inherits="Umbraco.Web.UI.Install.Steps.Skinning.LoadStarterKitDesigns" %>
<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %>

<asp:PlaceHolder ID="pl_loadStarterKitDesigns" runat="server">
<asp:Panel id="pl_CustomizeSkin" runat="server" Visible="false">
...


That's it for now.

Sunday, 29 September 2013

6.0.6 mono release delay

I was hoping to release the mono 6.0.6 version this Sunday, however, after having upgraded to mono 3.2.3, I started getting a strange error: it said the "ClientDependency.Core.CompositeFiles.CompositeDependencyHandler" could not be found. In reality, it was there but mono could not load the type.


I subsequently downgraded mono to 3.2.1, and then to 3.0.11. However, this time xsp broke.


Hence, I have decided to delay release until I know for sure what is going on, and this error is resolved.


On the plus side, I have fixed one more issue and identified a new one:


  • Fixed: Issue with SystemDirectories.Root being "" - mono expects a rooted value,
    in the virtual path utility: VirtualPathUtility.cs 271.

  • Identified: The umbraco code base makes reference to 'web.config' in ApplicationContextExtensions.cs, PluginViewEngine.cs, RenderViewEngine.cs, MediaUploader.ashx.cs, BaseSeleniumTest.cs. Mono can handle both 'web.config' and 'Web.config', but I will need make sure that we have the same behaviour in the Umbraco code base.


Saturday, 21 September 2013

uComponents in mono

The stock uComponents 5.4.1 package will not work in mono.


But we love this package and it is one of the best and most useful packages available for use with the Umbraco CMS.


Fortunately, the fixes required to compile uComponents in mono are very small. And here they are (all very minor casing issues):



$>hg diff

diff -r 510ecd773bcb uComponents.DataTypes/DataTypeGrid/Configuration/DtgConfiguration.resx
--- a/uComponents.DataTypes/DataTypeGrid/Configuration/DtgConfiguration.resx Thu Mar 14 20:11:24 2013 +0100
+++ b/uComponents.DataTypes/DataTypeGrid/Configuration/DtgConfiguration.resx Fri Sep 20 22:56:39 2013 +0100
@@ -119,6 +119,6 @@



- datatypegrid.config;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
+ DataTypeGrid.config;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8


\ No newline at end of file
diff -r 510ecd773bcb uComponents.DataTypes/DataTypeGrid/WebServices/DtgWebServices.resx
--- a/uComponents.DataTypes/DataTypeGrid/WebServices/DtgWebServices.resx Thu Mar 14 20:11:24 2013 +0100
+++ b/uComponents.DataTypes/DataTypeGrid/WebServices/DtgWebServices.resx Fri Sep 20 22:56:39 2013 +0100
@@ -119,6 +119,6 @@



- prevaluewebservice.asmx;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
+ PreValueWebService.asmx;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8


\ No newline at end of file
diff -r 510ecd773bcb uComponents.DataTypes/Shared/AjaxUpload/AjaxUploadHandlerResource.resx
--- a/uComponents.DataTypes/Shared/AjaxUpload/AjaxUploadHandlerResource.resx Thu Mar 14 20:11:24 2013 +0100
+++ b/uComponents.DataTypes/Shared/AjaxUpload/AjaxUploadHandlerResource.resx Fri Sep 20 22:56:39 2013 +0100
@@ -119,6 +119,6 @@



- ajaxuploadhandler.ashx.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
+ AjaxUploadHandler.ashx.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8


\ No newline at end of file
diff -r 510ecd773bcb uComponents.DataTypes/Shared/WebServices/SharedServices.resx
--- a/uComponents.DataTypes/Shared/WebServices/SharedServices.resx Thu Mar 14 20:11:24 2013 +0100
+++ b/uComponents.DataTypes/Shared/WebServices/SharedServices.resx Fri Sep 20 22:56:39 2013 +0100
@@ -119,6 +119,6 @@



- dictionaryservice.asmx;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
+ DictionaryService.asmx;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8


\ No newline at end of file
diff -r 510ecd773bcb uComponents.DataTypes/UrlPicker/Services/UrlPickerServiceResource.resx
--- a/uComponents.DataTypes/UrlPicker/Services/UrlPickerServiceResource.resx Thu Mar 14 20:11:24 2013 +0100
+++ b/uComponents.DataTypes/UrlPicker/Services/UrlPickerServiceResource.resx Fri Sep 20 22:56:39 2013 +0100
@@ -119,6 +119,6 @@



- urlpickerservice.asmx;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
+ UrlPickerService.asmx;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8


\ No newline at end of file
diff -r 510ecd773bcb uComponents.DataTypes/uComponents.DataTypes.csproj
--- a/uComponents.DataTypes/uComponents.DataTypes.csproj Thu Mar 14 20:11:24 2013 +0100
+++ b/uComponents.DataTypes/uComponents.DataTypes.csproj Fri Sep 20 22:56:39 2013 +0100
@@ -357,7 +357,7 @@



-
+



@@ -668,4 +668,4 @@



-
\ No newline at end of file
+
diff -r 510ecd773bcb uComponents.sln
--- a/uComponents.sln Thu Mar 14 20:11:24 2013 +0100
+++ b/uComponents.sln Fri Sep 20 22:56:39 2013 +0100
@@ -43,14 +43,10 @@
Settings.StyleCop = Settings.StyleCop
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uComponents.Core.UnitTests", "uComponents.Core.UnitTests\uComponents.Core.UnitTests.csproj", "{35953BAA-8E67-4E27-B4E5-96D142DC924B}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Unit Tests", "Unit Tests", "{026CA274-604D-49B5-932B-EB88A1E20BF3}"
- ProjectSection(SolutionItems) = preProject
- Local.testsettings = Local.testsettings
- uComponents.vsmdi = uComponents.vsmdi
- EndProjectSection
-EndProject
+
+
+
+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uComponents.XsltExtensions", "uComponents.XsltExtensions\uComponents.XsltExtensions.csproj", "{1665551B-1EE8-4A5A-8857-4A002F4DB3B9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uComponents.DataTypes", "uComponents.DataTypes\uComponents.DataTypes.csproj", "{E83250BD-27B0-4B39-90C8-F07538058938}"

One note: There might be some issues with the DataGrid component. But I have not had a close look at this yet.