SilentRage47
SilentRage47

Reputation: 952

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>

Upvotes: 1

Views: 789

Answers (2)

SilentRage47
SilentRage47

Reputation: 952

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.

Upvotes: 0

kunif
kunif

Reputation: 4360

There is a possibility that it is .NET 4.6 or higher that is built in Windows 10.
The latest Windows 10 1709 would be .NET 4.7.1.

Please try to make both. Windows7 and Windows10 .NET 4.6 or higher (latest 4.7.1).
Then, please change the properties of the app. project for that version, rebuild and test.

By the way:
The latest version of POS for.NET is 1.14.1. You should also refresh this one.
In the sample application project included in the SDK of POS for.NET 1.14.1, even if the similar processing as the question was done in MainForm.cs, it worked without problems.

Environment:
Windows10 Professional 64bit Version 1709
POS for.NET 1.14.1
Visual Studio Community 2017 Version 15.5.2
.NET Framework version from 4 to 4.7.1 Development Tool installed.

Sample Application Target Framework:
original: 4.0 client profile
changed: 4.7.1

Both of the target version numbers worked in my test.

Upvotes: 1

Related Questions