Search code examples
c#windowssql-server-2012-express

Unhandled exception running an application on Windows XP but works fine on Windows 7


We have an application that is going to be deployed on Windows XP that uses Entity Framework 6 and SQL Server Express.

Here's how the application's app config file looks :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>
  <connectionStrings>
    <add name="Rust" connectionString="Data Source=(ip here).\SQLEXPRESS;Initial Catalog=Rust;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>

Whenever we change the connection string to connect to an actual server and the application is being ran on Windows 7 it works fine. But if it is ran on Windows XP there occurs an unhandled exception which we cannot trace:

It happens when we try to retrieve some information from the database

Task.Factory.StartNew(() =>
{
    //here
    departments = new ObservableCollection<Department>(this.GetAllDepartments());
});

The SQL Server to which we connect is an SQL Server 2012 Express. Here's how the App config on the data access layer looks like:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb"/>
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityFramework>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>

Solution

  • Here's what the problem was :

    We have been using a VM named VirtualBox which had Windows XP installed on it. We tried installing Visual Studio 2010 and debugging the application from there but that wasn't successful. After two days of banging our heads about why this doesn't work we tried using the VMWare workstation and it it worked fine!! There must be some kind of problem with the VirtualBox software.

    Thank you guys for the suggestions!