Question

I'm using POS For .NET to use ticketprinters, scanners & scales in a opos application. I installed CCO from Monroe to get them to work on windows 7 / .NET 4.0, WPF application.

My Epson printers & Datalogic scanners are working perfectly. This is what I use to get it to work in my app.config.

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

Now I have an issue trying to work with Symbol scanners & Mettler toledo scales. They bouth give an accessviolation exception:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

When I try commenting the code between the scale works, but not the Symbol. Does any of you guys have any idea on how to fix this problem? Or what the underlying problem might be? I've been looking on the internet for days, so a solution would be very much appreciated.

Thanks, Zarkos

Was it helpful?

Solution

For anybody every having this issue:

--> never use Threading to activate/create object scanners, printers or scales.

This was my problem, some manufacturers do not support that.

OTHER TIPS

As Zarkos said, some devices do not like using threads when accessed via POS for .NET.

I recently had a problem with an AURES ODP-333 printer which would create a nasty crash when performing the printer.DeviceEnabled = true step. Calling that line from within a thread would crash vshost during debugging with no useful exception. Checking the Event Viewer, the errors were a random mix of BEX or APPCRASH faults referencing either MFC41.dll or something in my application but would always mention the exception code 0xc0000005, meaning an unmanaged access violation was happening somewhere.

It's worth noting that this doesn't affect all devices. An EPSON receipt printer and Honeywell barcode scanner have no beef with threads.

I would have liked to add this as a comment to Zarkos' answer but I don't have enough reputation yet! Sorry!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top