# Friday, March 27, 2009

This morning when I turned on my development computer I had the intention to re-factor some WPF user controls but every time I tried to open any of them in the designer Visual Studio 2008 will crash without any warning.

When I opened the Application error log I found the following message: 

Log Name:      Application
Source:        .NET Runtime
Date:          3/26/2009 11:07:53 AM
Event ID:      1023
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      SRV.Dev.CyberBizSoft.com
Description:
.NET Runtime version 2.0.50727.3074 - Fatal Execution Engine Error (70FC5FC0) (80131506)
Event Xml:
<Eventxmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <
System>
        <
ProviderName=".NET Runtime" />
        <
EventID Qualifiers="0">1023</EventID>
        <
Level>2</Level>
        <
Task>0</Task>
        <
Keywords>0x80000000000000</Keywords>
        <
TimeCreated SystemTime="2009-03-26T15:07:53.000Z" />
        <
EventRecordID>186149</EventRecordID>
        <
Channel>Application</Channel>
        <
Computer>SRV.Dev.CyberBizSoft.com</Computer>
        <
Security/>
    </
System>
    <
EventData>
        <
Data>.NET Runtime version 2.0.50727.3074 - Fatal Execution Engine Error (70FC5FC0) (80131506)

</Data>
    </EventData>
</Event>

After some online searching I found the following thread with this link to a hotfix to this problem. 

posted on Friday, March 27, 2009 2:43:16 AM UTC  #    Comments [0]
# Thursday, March 12, 2009

Earlier I posted about this problem I had with NHibernate, SQL CE 3.5.1.0 & ClickOnce. Well I found a workaround and it is very simple.

Instead of setting the "System.Data.SqlServerCe" reference property "Copy Local" to True,  when you are ready to deploy, set that reference property to false and on the ClickOnce Publish menu click on the "Application Files" button and change it from "Prerequisite (Auto)" to "Include".

Click for a bigger image!

You still have to set the "System.Data.SqlServerCe" reference property "Copy Local" to True while debugging your application locally for Nhibernate to work properly.

Remember to set it to false before publishing your application if not ClickOnce will remind you with the dreaded System.ArgumentException when launching the application. :-)

Click for a bigger image!

posted on Thursday, March 12, 2009 7:59:53 PM UTC  #    Comments [0]

Found Workaround!

I had wasted so much time with this ClickOnce error that I decided to create a new project and copy everything from the "bad" project and recreate all the references.

The deployment to ClickOnce worked fine but as soon as I logged into the application I got the following error from NHibernate:

image

The type initializer for 'CBSI.GL.Application.GLSetupService' threw an exception. (InnerException: Could not create the driver from NHibernate.Driver.SqlServerCeDriver.) (InnerException: Exception has been thrown by the target of an invocation.) (InnerException: The IDbCommand and IDbConnection implementation in the assembly System.Data.SqlServerCe could not be found. Ensure that the assembly System.Data.SqlServerCe is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element in the application configuration file to specify the full name of the assembly.)!

I had forgotten in the new project that with NHibernate you need to set the "System.Data.SqlServerCe" reference property "Copy Local" to True. As soon as I compiled and tested the debugging local copy it worked fine but when I deployed to ClickOnce the System.ArgumentException was back.

Since I noticed that I had a compiler warning and NHibernate.Driver.SqlServerCeDriver exception message say to "use <qualifyAssembly/> element" I added the following to my app.config:

<runtime>
    <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentassembly>
            <assemblyidentity culture="neutral" publickeytoken="89845dcd8080cc91" 
name="System.Data.SqlServerCe" />
            <bindingredirect newVersion="3.5.1.0" oldVersion="3.5.0.0" />
        </dependentassembly>
        <qualifyAssembly partialName="System.Data.SqlServerCe" 
fullName="System.Data.SqlServerCe,version=3.5.1.0,publicKeyToken=89845dcd8080cc91,culture=neutral"/>
    </assemblybinding>
</runtime>    

It didn't work either!

I found the culprit, SQL CE 3.5.1.0 but apparently it is either ClickOnce or NHibernate with .NET 3.5 SP1.

If someone has a workable solution please let me know!

posted on Thursday, March 12, 2009 12:36:55 AM UTC  #    Comments [0]