.Net AspNet 5: UriFormatException when creating ConnectionManager

Hello,

we want to upgrade our Aspnet Mvc project to the new AspNet 5, and using Data Abstract.
Now we get following Error while Creating the “RemObjects.DataAbstract.Server.ConnectionManager”:

System.UriFormatException "The URI is empty."
here is the call stack:

 System.dll!System.Uri.CreateThis(string uri, bool dontEscape, System.UriKind uriKind)    Unknown
 System.dll!System.Uri.Uri(string uriString)    Unknown
 System.dll!System.ComponentModel.Design.RuntimeLicenseContext.GetLocalPath(string fileName)    Unknown
 System.dll!System.ComponentModel.Design.RuntimeLicenseContext.GetSavedLicenseKey(System.Type type, System.Reflection.Assembly resourceAssembly)    Unknown
 RemObjects.DataAbstract.dll!RemObjects.DataAbstract.ROLicenseProvider.GetLicense(System.ComponentModel.LicenseContext context, System.Type aType, object anInstance, bool aAllowExceptions)    Unknown
 System.dll!System.ComponentModel.LicenseManager.ValidateInternalRecursive(System.ComponentModel.LicenseContext context, System.Type type, object instance, bool allowExceptions, out System.ComponentModel.License license, out string licenseKey)    Unknown
 System.dll!System.ComponentModel.LicenseManager.Validate(System.Type type, object instance)    Unknown
 RemObjects.DataAbstract.Server.dll!RemObjects.DataAbstract.Server.ConnectionManager.ConnectionManager(bool register)    Unknown
 RemObjects.DataAbstract.Server.dll!RemObjects.DataAbstract.Server.ConnectionManager.ConnectionManager()    Unknown

Hello

This exception happens deep in the internals of the .NET framework itself, most probably because one or more assemblies in the AppDomain return their CodeBase as empty string.

Could you run code like this (ie to enumerate all assemblies in the domain and to show their CodeBase):

foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
{
    if (asm.IsDynamic) 
       continue;
    System.Diagnostics.Debug.WriteLine(asm.Name + " - " + asm.EscapedCodeBase);
}

This would greatly help to pinpoint the cause of this issue.

Thanks in advance

Hello,
thanks for the quick reply. We run the Code and indeed one Assembly returns an empty String as a CodeBase, it is:

"Microsoft.Dnx.Host.Clr, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" has .EscapedCodeBase empty string"

Since in the new AspNet 5 with the new Roslyn Compiler there is a lot of Code that is live Compiled, so it’s likely that the “Microsoft.Dnx.Host.Clr” has no dll. Also we have no control over this Assembly of course.
Would it be possible that you could write a fix for this?
Thanks
Simon

Hello

Thank you for the information. So, just to confirm - all other assemblies (including Data Abstract and your web apps ones) have non-empty codebase?

Hello,

yes we checked again and only the “Microsoft.Dnx.Host.Clr” has a empty codebase.

here is our Output:
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll Microsoft.Dnx.Host.Clr, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 - System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll Microsoft.Dnx.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 - file:///C:/Users/USERNAME/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-final/bin/Microsoft.Dnx.Host.DLL System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll Microsoft.Extensions.PlatformAbstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 - file:///C:/Users/USERNAME/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-final/bin/Microsoft.Extensions.PlatformAbstractions.DLL System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll Microsoft.Dnx.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 - file:///C:/Users/USERNAME/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-final/bin/Microsoft.Dnx.Loader.DLL Microsoft.Dnx.ApplicationHost, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 - file:///C:/Users/USERNAME/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-final/bin/Microsoft.Dnx.ApplicationHost.DLL Microsoft.Dnx.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 - file:///C:/Users/USERNAME/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-final/bin/Microsoft.Dnx.Runtime.DLL Microsoft.Dnx.Compilation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 - file:///C:/Users/USERNAME/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-final/bin/Microsoft.Dnx.Compilation.DLL Microsoft.Dnx.Compilation.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 - file:///C:/Users/USERNAME/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-final/bin/Microsoft.Dnx.Compilation.Abstractions.DLL Microsoft.Dnx.Compilation.DesignTime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 - file:///C:/Users/USERNAME/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-final/bin/Microsoft.Dnx.Compilation.DesignTime.DLL AspNetTestApplication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - file:///C:/Users/USERNAME/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-final/bin/Microsoft.Dnx.Loader.dll [...] System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll System.Data.SqlXml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Data.SqlXml/v4.0_4.0.0.0__b77a5c561934e089/System.Data.SqlXml.dll [...] System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll [...] RemObjects.DataAbstract, Version=8.3.91.1167, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098 - file:///C:/WINDOWS/assembly/GAC_MSIL/RemObjects.DataAbstract/8.3.91.1167__3df3cad1b7aa5098/RemObjects.DataAbstract.dll RemObjects.SDK, Version=8.3.91.1167, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098 - file:///C:/WINDOWS/assembly/GAC_MSIL/RemObjects.SDK/8.3.91.1167__3df3cad1b7aa5098/RemObjects.SDK.dll RemObjects.DataAbstract.Server, Version=8.3.91.1167, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098 - file:///C:/WINDOWS/assembly/GAC_MSIL/RemObjects.DataAbstract.Server/8.3.91.1167__3df3cad1b7aa5098/RemObjects.DataAbstract.Server.dll RemObjects.SDK.Server, Version=8.3.91.1167, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098 - file:///C:/WINDOWS/assembly/GAC_MSIL/RemObjects.SDK.Server/8.3.91.1167__3df3cad1b7aa5098/RemObjects.SDK.Server.dll

the “[…]” are replacements for our Assemblies but they have a non-empty codebase as well.

thanks again for the quick response!

Thank you for the information.

Please send a mail to support@remobjects.com with your account name on http://remobjects.com and we’ll send you a Beta version with fix for this issue (once it is available).

Thanks, logged as bugs://73767

bugs://73767 got closed with status fixed.

Thanks, now it’s working. So the Issue seems resolved.