Search code examples
c#windows-10pos-for-.net

POS for .NET 1.14 System.TypeInitializationException error


I'm trying to create a .NET app that reads barcode from a Motorola LS2208 scanner.

Unfortunately The app crash at the start when I try to initialize the PosExplorer object

private void Form1_Load(object sender, EventArgs e)
{
    explorer = new PosExplorer(this);
}

This is exception it generates:

System.TypeInitializationException' in Microsoft.PointOfService.dll

I'm running it on a Windows 10 PC using .NET 4.5, the same project works fine on a Windows 7 PC.

Is there any problem with POS 1.14 on W10 ?

I already tried to add this to my appconfig file but the same problems occur:

<configuration>
  <runtime>
   <NetFx40_LegacySecurityPolicy enabled="true"/>
  </runtime>
</configuration>

Solution

  • I was able to resolve my problem by creating a new project. I initially created the old app in Windows 7 so something strange happened and made it not working on W10. Don't really know what could have been, I just recreated the project on W10 and the same code runs ok on both systems now.