Page 2 of 2

Re: Openlabel Method in parallel threads

Posted: Thu Dec 12, 2019 4:04 pm
by Mytch
margy82 wrote:
Wed Dec 11, 2019 3:49 pm
Many thanks Mytch, sorry for the disturb
Margy,

I received response from development about this. They seem to agree that print engine is being shut down too early. Moving to after final readline allows program to work (sometimes). Here is exact response:

"You cannot shutdown the print engine while it's being used. As you correctly found out, moving the Console.Readline() before the print engine shutdown will make things work.

This is probably just a sample code but the code as is it written would not work correctly since the created threads are background threads and they are terminated once the main thread has finished execution".

So again, it seems like this is possible but there are small issues. Hopefully this information leads you to a resolution.

Mytch

Re: Openlabel Method in parallel threads

Posted: Thu Dec 12, 2019 7:36 pm
by margy82
Mmm...no Mytch it doesn't work. Anyway threads stopped before calling ShutDown(). I use the join method to wait for all threads finished. I tried moving Console.Readline() before shutting down PrintEngine but with the same results. I tried also to force interrupt for all threads but it still crash. If you try to run the code 2 or 3 times it starts to crash. It is not stable.

Re: Openlabel Method in parallel threads

Posted: Thu Dec 12, 2019 10:02 pm
by margy82
Ok, some step away….I try to change the signature of the call of OpenLabel using FStream and I doscover that when this method is invoked it creates some .tmp file in "C:\Users\USERNAME\AppData\Local\Temp\" . For some reason these tmp file creates a kind of conflict when I restart the app so if I delete these files before relaunch everything works. Any idea?

Thanks

Re: Openlabel Method in parallel threads

Posted: Fri Dec 13, 2019 6:06 pm
by Mytch
Margy,

As discussed, I and Development have confirmed the sample application is workable under certain scenarios. Having background threads will terminate once the main has, so results can be inconsistent with this configuration. Nonetheless, moving the PrintEngine Shutdown allows all 4 labels to be opened and printed without an issues (sometimes). I have tested this many times and don't understand what kind of crashing your usage of OpenLabel.

Can you tell me what version of NiceLabel 2017 is installed? You can update to 17.3.1 here:
http://ftp.nicelabel.com/software/demo/ ... el2017.exe

I've tested this with 17.3.1 API and latest 19.2 API. Unfortunately, I cannot speak to the FStream behavior, because I do not understand what you're trying to accomplish here. Is this an unrelated issue?

Mytch

Re: Openlabel Method in parallel threads

Posted: Fri Dec 13, 2019 7:22 pm
by margy82
Now I can't check exactly but if I'm not wrong I have a 2017.1 version. Is the update to 2017.3 free or I have to purchase a new licence? I don't understand what do you mean when you write "moving the PrintEngine Shutdown allows all 4 labels to be opened and printed without an issues (sometimes)". For the OpenLabel method I can pass a filestream instead of the path.

Thanks

Re: Openlabel Method in parallel threads

Posted: Sun Dec 15, 2019 12:02 pm
by margy82
Mytch, you' re right. Updating from 2017.1 to 2017.3 (it is free) everything seems to work correctly. I try to open more than 40 labels from different threads without crash. Fantastic. Another question. There are important differences and/or improvements between sdk 2017.3 and latest sdk 2019 ?

Re: Openlabel Method in parallel threads

Posted: Mon Dec 16, 2019 4:43 pm
by Mytch
margy82 wrote:
Sun Dec 15, 2019 12:02 pm
Mytch, you' re right. Updating from 2017.1 to 2017.3 (it is free) everything seems to work correctly. I try to open more than 40 labels from different threads without crash. Fantastic. Another question. There are important differences and/or improvements between sdk 2017.3 and latest sdk 2019 ?
Margy,

Thanks for the update - glad to hear!

As far as major changes from 2017.3.1 API to 19.2, there really isn't anything of much significance. Some small things to interface better with Control Center, like Forms Authentication is now supported, reporting to Analytics, few improvements to dynamic/global variable handling, and some improvements to VBScript and other 32-bit processes. The client applications and Control Center (LMS licensing) received many new features and improvements, but API/SDK major components are mostly the same.

You can find all Release Notes here:
https://www.nicelabel.com/downloads/release-notes

Bug fixes are not included in Notes, but there were some in 2019 version updates, of course. Many technologies are moving towards "Cloud" now, so we have introduced many integrations with NiceLabel Label Cloud, Automation Cloud Trigger, Cloud Printing, etc. More and more companies are now relying on native functionality rather than having a custom-developed application utilizing .NET API. Some of the struggles described here are already solved with NiceLabel applications, like multi-threaded printing in Automation and detailed print status reporting abilities.

I understand if you continue to use a custom application, because the solution control is virtually unlimited, but maybe you can consider an upgrade to 2019 using some more native NiceLabel functions. You can always use the 30-day Free Trial (includes API access) and see how you like it:
https://www.nicelabel.com/downloads/nicelabel

To get a trial of LMS or Label Cloud, you should contact Sales directly:
https://www.nicelabel.com/how-to-buy/contact-us

Depending on your current license agreements, you may have a free upgrade path to NiceLabel 2019 already. I recommend that you reach out, once you have some spare time. :)

Regards,
Mytch

Re: Openlabel Method in parallel threads

Posted: Mon Dec 16, 2019 6:09 pm
by margy82
Yes Mytch I read the documentation and features of all moduls like Automation and cloud but far my company I need something more specific and the sdk gives me every possibilities of personalization that i need

Thank you again