Quantcast
Channel: SQL Server Compact Forum
Viewing all articles
Browse latest Browse all 193

System.Data.SqlServerCeException.ToString Throwing a null reference exception.

$
0
0

I have an Add-In to Microsoft Project 2010 that uses Microsoft SQL CE 3.5 SP2.  The Add-In is built using the .net framework 4.0 and VSTO 2010.  I have a customer who is using the Add-In and is getting the following exception and stack trace:

ExceptionType: System.NullReferenceException Stack Trace:    at System.Data.SqlServerCe.SqlCeException.ToString()
   at System.String.Concat(Object arg0, Object arg1)
   at DataModel.Persistence.Db.CreateDatabase()

The null reference exception seems to occur when ToString() is called on the exception itself.

'DataModel' in this case is my code. The code for 'CreateDatabase' and the relevant using statements can be seen below. I am not able to reproduce this on my dev environment and so far as I know only one customer has experienced this issue. Additionally I have checked that they are running the appropriate version of SQL Server CE.

My question is:

 Has anyone experienced behavior like this?  Are there any suggestions on how to reproduce, diagnose, or fix?

 

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlServerCe;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using Exception = System.Exception;
using System.Collections.ObjectModel;
using MentorUtils;
using System.Data.SqlClient;
using InterfacesLibrary;
using MsProjectTypeExtensions;
using System.Reflection;



private static void CreateDatabase() 
{
    try 
    {
   
       SqlCeEngine engine = new SqlCeEngine(ConnString);
       engine.CreateDatabase();
    }
    catch(Exception e) 
    {
        MessageBox.Show("Unable to create database: " + e);
    }
}




 


Viewing all articles
Browse latest Browse all 193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>