SQLiteCrash on Startup

Bug reports and questions about running Virtual Radar Server on Linux
Post Reply
Celestial
Posts: 8
Joined: Thu Feb 06, 2014 9:44 pm

SQLiteCrash on Startup

Post by Celestial » Wed Jun 03, 2015 5:57 pm

Bought a new Gigabyte Brix and installed latest version of Ubuntu Mate. Unfortunately VRS is crashing on startup with a Fatal unhandled exception and it looks suspicious:

WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
[ERROR] FATAL UNHANDLED EXCEPTION: InterfaceFactory.ClassFactoryException: SQLiteConnectionStringBuilderWrapper does not implement ISQLiteConnectionStringBuilder
at InterfaceFactory.ClassFactory.Register (System.Type interfaceType, System.Type implementationType) [0x00000] in <filename unknown>:0
at InterfaceFactory.ClassFactory.Register[ISQLiteConnectionStringBuilder,SQLiteConnectionStringBuilderWrapper] () [0x00000] in <filename unknown>:0
at VirtualRadar.SQLiteWrapper.Implementations.Register (IClassFactory factory) [0x00000] in <filename unknown>:0
at VirtualRadar.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

I looked over the source for SQLiteConnectionStringBuilderWrapper.cs and the only class is SQLiteConnectionStringBuilder. There isn't a class ISQLiteConnectionStringBuilder (that is an i, not an L).

Any hints?

Cel

agw
Posts: 2241
Joined: Fri Feb 17, 2012 3:20 am

Re: SQLiteCrash on Startup

Post by agw » Sat Jun 06, 2015 3:42 pm

When Mono 4 came out (which was fairly recently) they dropped support for the .NET 3.5 runtime. Unfortunately VRS is using .NET 3.5 as that's the version that comes with Windows 7. So that's what Mono is talking about with the "runtime not supported, using .NET 4's runtime instead" bit at the start of the message. In principle it should work, but I've not yet tried it.

The next message, SQLiteConnectionStringBuilderWrapper does not implement ISQLiteConnectionStringBuilder, is saying that VRS's class factory won't let the program register the SQLiteConnectionStringBuilderWrapper class as an implementation of ISQLiteConnectionStringBuilder interface. The interface is in VirtualRadar.Interface.SQLite and the Mono implementation is in SQLiteWrapper.Mono. The reason why the wrapper exists is because the official ADO.NET provider that SQLite.org supplies (a) has different names and namespaces to Mono's SQLite library and (b) doesn't (or didn't) run properly under Mono. I worked around this by using wrappers that expose the same interface regardless of whether you are running under .NET or Mono, then having two wrapper libraries - one for .NET, one for Mono - and shipping the appropriate wrapper library with each build. The rest of the program asks the class factory for an implementation of the interface at runtime so it doesn't care whether it's using the Mono wrapper or the .NET wrapper.

SQLiteConnectionStringBuilderWrapper does implement ISQLiteConnectionStringBuilder, the only way you can get a mismatch there is if you use an old wrapper library... but that interface hasn't changed in a very long time, it's unlikely that you've done that. I think it's more likely that Mono might have changed something about their SQLite library for Mono 4 and that the message is hiding something more fundamental.

I keep meaning to get Mono 4 installed, someone else hit a problem with Mono 4 on OSX - I shall try to take a look at it today and see how I get on.

ertyu
Posts: 12
Joined: Fri Nov 14, 2014 8:30 pm

Re: SQLiteCrash on Startup

Post by ertyu » Sat Jun 20, 2015 10:39 pm

Just adding a ditto, getting the same error when trying with Mono 4

agw
Posts: 2241
Joined: Fri Feb 17, 2012 3:20 am

Re: SQLiteCrash on Startup

Post by agw » Sun Jun 28, 2015 10:14 pm

OK, sorry for the delay in looking at this. The show-stopping error is caused by Mono 4 shipping with a Mono.Data.Sqlite assembly that's marked as version 4 (not surprisingly) whereas VRS is looking for version 2.

You can tell VRS to load version four by creating a text file in the VRS program folder called VirtualRadar.exe.config and then pasting this into it:

Code: Select all

<?xml version="1.0"?>
<configuration>
    <configSections>
    </configSections>
    <startup>
        <supportedRuntime version="v2.0.50727"/>
    </startup>
    <runtime>
        <assemblyBinding  xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Mono.Data.Sqlite"
                                  publicKeyToken="0738eb9f132ed756"
                                  culture="neutral" />
                <bindingRedirect oldVersion="2.0.0.0"
                                 newVersion="4.0.0.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>
If the file already exists then overwrite it. It must be in the same folder as VirtualRadar.exe.

Other than that version 4 works fine for me under Ubuntu 15.04, with the exception of that on-the-fly compilation error coming out of Mono's implementation of XmlSerializer. I have written my own XmlSerializer to get rid of that, if you want to have a go with it then you can download a preview version of VRS from here:

http://www.virtualradarserver.co.uk/Preview.aspx

The message about the runtime version not being present and it having to use runtime v4 is benign, VRS appears to run fine under v4.

ertyu
Posts: 12
Joined: Fri Nov 14, 2014 8:30 pm

Re: SQLiteCrash on Startup

Post by ertyu » Tue Jun 30, 2015 12:32 am

Yep, it's working now on 4, just have those same GDI errors drawing icons and images that I had previously.

neactom
Posts: 1
Joined: Sat Aug 15, 2015 1:34 am

Re: SQLiteCrash on Startup

Post by neactom » Sat Aug 15, 2015 1:38 am

I am still getting this error as well, even after adding the .config file to the directory.
Any thoughts?

agw
Posts: 2241
Joined: Fri Feb 17, 2012 3:20 am

Re: SQLiteCrash on Startup

Post by agw » Tue Aug 18, 2015 8:50 am

Linux is case sensitive - is the filename in the correct case? If you haven't renamed VirtualRadar.exe then it should be VirtualRadar.exe.config, not (for example) virtualradar.exe.config, VirtualRadar.exe.Config etc.

Post Reply