SQL Server CE 4.0 deployment issue--which files are necessary? - c#

I'm trying to deploy a small Windows Form app that uses a SQL Server CE 4.0 database. I don't want every system running this application to have to install SQL Server CE 4.0, so I'm trying to get any required DLLs included with the application.
When I check the references list, the only reference for SQL Server CE 4.0 is System.Data.SqlServerCe. Including the DLL for that, System.Data.SqlServerCe.dll, still leads to the following error when attempting to connect to the database:
Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8876. Install the
correct version of SQL Server Compact. Refer to KB article 974247 for
more details.
I've seen a few articles talking about this for different versions of SQL Server CE, but they listed DLLs for other versions, as far as I could tell. The systems the app will be running on should all have at least Windows 7 with .NET 4.0 installed, if that makes a difference.
I tried the steps located here to add the files as shown in the link: http://erikej.blogspot.com/2011/02/using-sql-server-compact-40-with.html
With those files included in the build, the program compiles without any errors, but when run on a secondary system, the GUI never appears (part of the public Form1() includes a method that grabs data from the SQL CE database) and the program just closes after a couple of seconds. The event viewer shows this error:
Faulting application name: Dispatch Review Assistant.exe, version: 1.0.0.0, time stamp: 0x50915d3c
Faulting module name: KERNELBASE.dll, version: 6.1.7601.17932, time stamp: 0x503285c2
Exception code: 0xe0434352
Fault offset: 0x000000000000caed
Faulting process id: 0x1028
Faulting application start time: 0x01cdb78c10761c73
Faulting application path: C:\Users\deLucain\Desktop\Release\Dispatch Review Assistant.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: 4e4f45e3-237f-11e2-bd76-14dae92102de

We had the same error message showing up when doing a private deployment (ie including libraries in application folder) of SQLCE 4.0 application.
When adding references to our project, we had added the x64 and x86 folders (and associated dlls) as per the documentation.
At this point, we got the error :
Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8876. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
In our environment, we found that the amd64 folder found under :
%Program Files%\Microsoft SQL Server Compact Edition\v4.0\Private
was also needed.
After adding it to the project and referencing the contained dlls, our issue was resolved.

Related

WPF application crashing on Windows Server 2008

I received an error report regarding a WPF app that wouldn't start up in a Windows Server 2008 Service pack 2 server (the application is an administration tool we're distributing to our customers). Since this application has a lot of external references, I tried to simplify the problem by creating a simple WPF application using Visual Studio 2013: a plain white window with "hello world" showing and nothing more. I tried to make it run in the production server, with no luck: it always crashes immediately.
Here's what I have:
the application was created with the standard VS 2013 template for WPF, so it had 3.5 as the target framework; i changed it to 4.6
the server has the 3.5 SP1 and 4.6 versions of the .net framework installed
the app.config is well-formed, with the configSections section on top, no additional references besides log4net, supportedRuntime tag set according to the target framework version
I already checked that there are no project references from version 3.5 left in the project
I already tried logging in the DispatcherUnhandledException and in the AppDomain.UnhandledException handlers
the application runs in my development environment
the application runs in production environment only if I change the target framework to 3.5. In this case, the WPF windows shows up and the log file is correctly produced
I already tried producing a dump and trying to debug it in Visual Studio: I just get a "Source not available" message and a stack trace ending with ntdll.dll!NtWaitForSingleObject()
Here are the error details:
Description:
Stopped working
Problem signature:
Problem Event Name: APPCRASH
Application Name: MyApp.exe
Application Version: 1.0.0.0
Application Timestamp: 5bfc07f1
Fault Module Name: KERNEL32.dll
Fault Module Version: 6.0.6002.24367
Fault Module Timestamp: 5ae3dcd9
Exception Code: e0434352
Exception Offset: 000000000001667d
OS Version: 6.0.6002.2.2.0.272.7
Locale ID: 1033
The Windows event log shows little information:
Faulting application MyApp.exe, version 1.0.0.0, time stamp 0x5bfc07f1, faulting module KERNEL32.dll, version 6.0.6002.24367, time stamp 0x5ae3dcd9, exception code 0xe0434352, fault offset 0x000000000001667d, process id 0x%9, application start time 0x%10.
Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: exception code e0434352, exception address 0000000077A6667D
Stack: [this is empty]
Any suggestions?
Just in case someone else stumbles on the same problem, looks like the KB4457921 update from Microsoft somehow solves the issue. If an update is not possible, consider porting the code back to .net framework v. 3.5.

C# application using Microsoft.Office.Interop.Excell dll throws exception(error: 80080005) when Windows trusted apps is installed with OS installation

Issue:
I am facing an issue in Win10 PC while running a C#application created in VS 2013. The application always throws exception when it tries to create excel instance.
Microsoft.Office.Interop.Excel is added in project reference(:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15\Microsoft.Office.Interop.Excel.dll)
The below Exception is obtained:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))
From event viewer I see the error related to excel.exe version 16 bing called:
Faulting application name: EXCEL.exe, version: 16.0.8528.2136, time stamp: 0x59d6c372
Faulting module name: KERNELBASE.dll, version: 10.0.16299.371, time stamp: 0xee297154
Exception code: 0xc06d007f
Fault offset: 0x00103ef2
Faulting process id: 0x2c8c
Faulting application start time: 0x01d41f1db8e05601
Faulting application path: C:\Program Files\WindowsApps\Microsoft.Office.Desktop.Excel_16000.8528.2136.0_x86__8wekyb3d8bbwe\Office16\EXCEL.exe
Faulting module path: C:\windows\System32\KERNELBASE.dll
Report Id: 5c23fa18-770c-4233-b803-e57c2bf68174
Faulting package full name: Microsoft.Office.Desktop_16000.8528.2136.0_x86__8wekyb3d8bbwe
Faulting package-relative application ID: Excel
Code snippet:
The application is trying to create an instance of Microsoft.Office.Interop.Excel.Application:
public ExcelReader()
{
try
{
m_excelApplication = new Microsoft.Office.Interop.Excel.Application();
}
catch(System.Exception Exp)
{
MessageBox.Show( Exp.Message );
}
}
Environment details:
During OS installtion there is something called trusted apps which is installed by default. We can see the icons related to Excel 2016, Word 2016 etc in Windows option.
But in my machine only Office 2013(64 bit) is installed after fresh OS installation.I have the exe for MS office 2013 present in "C:\Program Files\Microsoft Office\Office15\EXCEL.EXE"
Why is the excel.exe version 16(C:\Program Files\WindowsApps) called when application launches
Issue is observed in machines which have MS office 2016, MS office 2013 installed which has the trusted apps(2016) installed by default.
Could somebody help me out on this.
After hours and hours of searching the web for an answer regarding this issue, I have found that under Component Services > Computers > My Computer > DCOM Config > Microsoft Excel Application >> Properties panel - [Identity tab], the default setting for Windows 10 is The launching user, while on Windows 7 the default one is The interactive user. Changing the identity setting on Windows 10 to The interactive user solved this issue for me.
Hope this will save other people the amount of time it took me to find an answer.
This issue happens because of Interop libraries. The Interop libraries have different methods in different versions. You have to check the version of Interop libraries that you currently have and use appropriate libraries that you need for current Office that is installed.
On that Microsoft page you can see the information where you can get Introp libraries for installed office version.
If you want to support multiple office versions, you have to install the minimal version that you clients can have (2010 for example) and then write proxy classes that will detect version of MS Office and use their functionality and methods via CLSID.

A native exception occurred in .Net EXE

I have developed a C#.net windows form application to get and update data from /to a SQL server CE database.While I'm running this app on windows ce 6.0 machine, getting following error:
A native exception occurred in ItemDB.exe(my exe name).
Details:
Exception code : 0x80000002
Exception address: 0x40e843b4
Faulting module: sqlceme35.dll
offset: 0x000043b4
at
NavigateMethod.GetKeyInfo(parm1,parm2,...)
at
SqlCEDataReader.FillMetaData(command)
at
sqlCeCommand.InitializeDataReader()
So I searched in net and found this link:
http://go4answers.webhost4life.com/Example/cant-find-pinvoke-dll-sqlceme35dll-49162.aspx
http://blogs.msdn.com/b/sqlservercompact/archive/2007/10/26/can-t-find-p-invoke-dll-sqlcemenn-dll.aspx
As suggested, I copied ZIP file(because, I didn't get Cab files) and changed this to .Cab.Then I tried to run Cab,But, its saying "this is not a valid wince setup file".
Hope I explained it clearly.Could anyone please help me?
This is almost always caused by a SQL CE version difference between what you compiled against on the PC and what you have deployed on the device. Make sure that the SQL CE version number is identical in both your project references and what is on the device. Typically I add the reference not from the ".NET" tab in references, but I specifically brows to the reference so I know exactly which file is being used, and then manually deploy SQLCE from the same location to the device.
*EDIT
The location you should be looking for the files to deploy is here:
C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\armv4i
And your project reference should point here:
C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\System.Data.SqlServerCe.dll

C#.Net X64 Application crash when using 64bit dll

I have a problem running a C# application(WPF, .Net 4.0, Visual Studio 2010) targeted to x64 and uses 64bit dll (3rd party).
The problem appear when I run the 64bit version with 64bit dll(on 64bit Win7/WindowsServer2003). The application start OK. But when I hit start button on the app, where the app create thread and start interacting with the dll, the thread will crash/stop at the first call to dll function.
Below is the error generated, when I close the app.
Problem signature:
Problem Event Name: APPCRASH
Application Name: DelayServer.exe
Application Version: 1.0.0.0
Application Timestamp: 52092104
Fault Module Name: KERNELBASE.dll
Fault Module Version: 6.1.7601.17965
Fault Module Timestamp: 506dcae6
Exception Code: e0434352
Exception Offset: 000000000000bccd
OS Version: 6.1.7601.2.1.0.272.7
Locale ID: 2057
Additional Information 1: 7315
Additional Information 2:
73159f4fb34892aabcc4ba245f14f64e
Additional Information 3: d5ec
Additional Information 4:
d5ec134b8e354c23783e48c0e2e572da
I understand that this is possible if there is a mismatch between the EXE and DLL i.e. EXE being a 32bit and DLL being 64bit or vice versa.
Attached is the screenshot of my settings. I didn't find a way to verify/edit my x64 platform settings.
x64 Project Build Settings screenshot
My Development computer is Win Vista 32bit and I have installed 64bit compilers.
I have 32bit targeted application using 32bit dll working OK on 32bit comupters.
The crash happens when I run 64bit targeted application with 64bit dll on 64bit computer
I tried dependencywalker, but I can't expland further to find any dependencies.
Can someone please help me with this.
Many Thanks
Sam
I have finally resolved the problem.
When I used Microsoft Debug Diagnostic Tool (from http://www.microsoft.com/en-gb/download/details.aspx?id=26798) the crash dump shows that there is a problem loading my external dll or its dependencies. I then loaded the my external dll into Dependency Walker (http://dependencywalker.com/) it shows that it can't find a dependency "msvcp100.dll" which is linked to Microsoft VC++.
So I installed Microsoft re-distributable package (x64) and my app doesn't crash any more.
Thanks every one for your help...

Faulting application <app_name>, version <version number>,faulting module kernel32.dll

I have one windows application built using C# and .net framework 2.0 and its installed on Windows Server 2003.
I have tested application on my machine and it works perfectly on my machine. Only difference between two machines is that, my machine has Windows Vista OS and machine on which error occured has Windows Server 2003 OS.
When I start application, it works correctly for some time but then gives one error as
Faulting application ,
version ,faulting
module kernel32.dll,version 5.2.3790.4480, stamp , debug? 0. fault address 0x000bef7.
Source : .NET Runtime 2.0 Error
Category : None
Event ID : 1000
Does anyone knows why this error is coming? I googled for this error but most of the solutions were for either explorer.exe or internet explorer.
Use windbg or adplus to attach to the process and get the process crash dump. This would help you to identify the offending part of the code with symbols loaded. In most cases, it shows the last exception and hence gives a very good view of what could have gone wrong.

Categories

Resources