Issues with Phidget22 after migrating to .NET 6.0 framework

Supporting Visual Studio on Windows
Arnaud
Fresh meat
Posts: 3
Joined: Mon Mar 21, 2022 6:34 am
Contact:

Issues with Phidget22 after migrating to .NET 6.0 framework

Post by Arnaud »

Hello there,

Ive been working with the Phidget nuget package 1.6.20200709 in a NetCore3.1 WPF application for a while and everything went fine.
We recently decided to move to the .NET6 framework and I came across a new issue : When calling DigitalOutput methods the exe crashes. All information I have are from the event viewer :

Application: Phoenix.Ui.exe
CoreCLR Version: 6.0.322.12309
.NET Version: 6.0.3
Description: The process was terminated due to an unhandled exception.
Exception Info: System.DllNotFoundException: Dll was not found.
at Phidget22.Phidget22Imports.Phidget_setOnAttachHandler(IntPtr phid, AttachEvent fptr, IntPtr ctx)
at Phidget22.Phidget.uninitializeBaseEvents()
at Phidget22.Phidget.uninitializeEvents()
at Phidget22.DigitalOutput.Finalize()

An interesting fact is that I have the crash when I launch a published exe , but it works perfectly in VS2022, in both debug and release mode.
I updated the Phidget22 package to the last version 1.10.20220211 and I still have the same problem.

Im wondering if these Phidget22 packages are already compatible with the NET6 framework ? If so any idea on the causes of my issue ?

Thanks a lot!
Arnaud
Fresh meat
Posts: 3
Joined: Mon Mar 21, 2022 6:34 am
Contact:

Re: Issues with Phidget22 after migrating to .NET 6.0 framework

Post by Arnaud »

Any ideas ?
User avatar
Patrick
Lead Developer
Posts: 3399
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Issues with Phidget22 after migrating to .NET 6.0 framework

Post by Patrick »

This is likely an issue where the embedded C libraries aren't getting published along with the .net dll - you may have to manually include them. The .net library looks for the C library at dll/x86/phidget22.dll or dll/x64/phidget22.dll depending on architecture.

-Patrick
Arnaud
Fresh meat
Posts: 3
Joined: Mon Mar 21, 2022 6:34 am
Contact:

Re: Issues with Phidget22 after migrating to .NET 6.0 framework

Post by Arnaud »

Hello Patrick,

and thanks for your answer. Unfortunately the phidget22.dll is included in my published application. The issue must be somewhere else.

Thanks for the tip anyway
User avatar
Patrick
Lead Developer
Posts: 3399
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Issues with Phidget22 after migrating to .NET 6.0 framework

Post by Patrick »

Hi,

I'll need to replicate the issue and get back to you.

-Patrick
rvb
Fresh meat
Posts: 3
Joined: Mon May 02, 2022 6:16 am
Contact:

Re: Issues with Phidget22 after migrating to .NET 6.0 framework

Post by rvb »

Hello Patrick,
I worked with Arnaud (who left the project) and I would like to provide you more insights about the issue faced with Phidget22 package since we moved to .Net6 framework.

Actually the issue is systematically faced when we build our application using the option '-p:PublishSingleFile=true'.

As soon as this option is removed all works well. It is like if Phidget22 package were not compatible with that option from .Net6 framework. Previously same project was under .NetCore3.1 and we never faced same issue whereas we already built a singlefile solution.

Last week I updated the package to the latest stable version 1.10 20220413 and the issue is still there.

Can you try to reproduce that issue, then to fix it and keep us posted.
Thanks for your support.

PS: just to be fully transparent find thepublish cmd reproducing the issue with .Net6 only : "dotnet publish Phoenix.Ui -c Release -o ./Phoenix -p:PublishSingleFile=true -r win-x86 --self-contained true"

rv
User avatar
Patrick
Lead Developer
Posts: 3399
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Issues with Phidget22 after migrating to .NET 6.0 framework

Post by Patrick »

Hi,

Thanks for the insight. This issue is on my list to look into.

-Patrick
rvb
Fresh meat
Posts: 3
Joined: Mon May 02, 2022 6:16 am
Contact:

Re: Issues with Phidget22 after migrating to .NET 6.0 framework

Post by rvb »

Hi Patrick,
just to keep you posted I solved critical crash issue we got by porting our Phidget DLL on .Net6 framework by upgrading VS to version 17.2.

Issue was faced with VS v17.1.3 and was due to runtime dedicated to win-x86.

rv
rvb
Fresh meat
Posts: 3
Joined: Mon May 02, 2022 6:16 am
Contact:

Re: Issues with Phidget22 after migrating to .NET 6.0 framework

Post by rvb »

To complete the picture it seems mandatory to have the control panel installed with the same version (v1.10.20220413) than the nuggets package in use on the test station to have the solution working.
User avatar
Patrick
Lead Developer
Posts: 3399
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Issues with Phidget22 after migrating to .NET 6.0 framework

Post by Patrick »

This probably means that it's grabbing the C dll from the control panel install instead of the embedded one. I still need to work through what's going on here.

-Patrick
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest