1

My programm is running without any problems, on my current laptop (x64). But when I try to run it on an other PC (x86) it crashes before starting. I also tried to change the platformtarget, as described in this answer: XMLParseException occurs

I also catched all unhandled exceptions. That delivers me two exceptions:

enter image description here

I also got that from reliability history:

Faulting application name: LoginDemo.exe, version: 1.0.0.0, time stamp: 0x56c19003 Faulting module name: KERNELBASE.dll, version: 6.1.7601.17651, time stamp: 0x4e2111c0 Exception code: 0xe0434352 Fault offset: 0x0000d36f Faulting process id: 0x4b0 Faulting application start time: 0x01d167cd96535e01 Faulting application path: C:\Users\hgservice\Desktop\Temp\LoginTool2\LoginDemo\bin\Release\LoginDemo.exe Faulting module path: C:\Windows\system32\KERNELBASE.dll Report Id: d6435b26-d3c0-11e5-b9a7-001999d6cbe5

I also read that the problem could occure because the programm tries to import a DLL while running, but all DLLs that I need for the exe are in the same folder. And as I said on my laptop it is working fine. Has anyone an idea what the problem could be?

Community
  • 1
  • 1
L4c0573
  • 333
  • 1
  • 7
  • 23
  • Do any of your other dlls need a runtime? your laptop may be having it but the other pc wont be having it. – Betson Roy Feb 16 '16 at 06:54
  • What is your application doing? The problem seems to be to do with a smart card resource manager... are you doing things with smart cards? Check which services are running on your working machine compared with the non-working one. – Jon Skeet Feb 16 '16 at 06:57
  • XMLParseException or XAMLParseException? Please edit subject and body to reflect actual exception encountered. – Jens Meinecke Feb 16 '16 at 07:03

2 Answers2

1

This problem has nothing in common with WPF as such. If we analyse the stacktrace we can see that it is thrown by pcsc-sharp library. The more careful analysis will show that NoServiceException exception was thrown because the following native method returned an error:

[DllImport(WINSCARD_DLL, CharSet = CharSet.Auto)]
private static extern int SCardEstablishContext(...)

More precisely NoServiceException is mapped to the SCARD_E_NO_SERVICE (0x8010001D) error. It means that probably SmartCard service on your laptop is not running. To fix it: press Win+R, type services.msc and start SmartCard service.

This problem can be also caused by differences between various versions of Windows (for details see this question).

Another cause of this problem might be the lack of sufficient permissions (see this article).

Community
  • 1
  • 1
Michał Komorowski
  • 6,198
  • 1
  • 20
  • 24
  • I tried to start the SmartCard service but an error occured. It says: Windows could not start the Smart Card service on Local Computer. Error 1058: The service cannot started, either becuase it is disabled or because it has no enabled devices associated with it. – L4c0573 Feb 16 '16 at 09:00
  • But it isn´t disabled and the NFC-Smartcard Reader is plugged in. And i also installed all drivers for this reader. It is shown in device manager as smartcardreader – L4c0573 Feb 16 '16 at 09:09
  • Is it possible to start the smartcard service via C#? So that I not have to check manually if the service is running, everytime I start my application on another pc? – L4c0573 Feb 16 '16 at 09:24
0

Okay guys I fixed it. As Michał Komorowski and Jon Skeet already answered, the problem was that the Smard Card sevice was not running. The answer of Michał Komorowski is almost correct. The only thing I had to do furthermore, was to set the startup type on "manual". After that I could start the Smart Card service and now everything is working.

enter image description here

L4c0573
  • 333
  • 1
  • 7
  • 23