Search found 6 matches

by jrager
Fri Dec 22, 2023 3:26 am
Forum: SUB-20 General Discussion
Topic: Looking to determing possible causes of error 2 - Can't open SUB device
Replies: 1
Views: 1685

Looking to determing possible causes of error 2 - Can't open SUB device

Hi all, Wondering if anyone can tell me all of the conditions that would trigger the DLL to report an error 2 - Can't open SUB device. Some background: I'm developing some code that runs two threads - one thread polls connected devices checking to see if a device has been connected/disconnected and ...
by jrager
Fri Nov 03, 2023 8:53 pm
Forum: SUB-20 General Discussion
Topic: System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll
Replies: 8
Views: 3099

Re: System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll

Hi serg, I believe I found the solution! It does appear to have something to do with the publish command embedding the DLL into the exe by default. By specifying CopyToPublishDirectory and ExcludeFromSingleFile in csprog, the DLL is excluded from the exe and instead copied to the output folder: <Ite...
by jrager
Fri Nov 03, 2023 4:38 pm
Forum: SUB-20 General Discussion
Topic: System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll
Replies: 8
Views: 3099

Re: System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll

Hi serg, I haven't run into that publish issue. On my end, the publish completes and generates a single exe and a pdb into my publish folder. It's only when I attempt to run the exe that it fails with the BadImageFormatException. FWIW, here's the publish command I've been using: dotnet publish -p:Pu...
by jrager
Mon Oct 30, 2023 3:16 pm
Forum: SUB-20 General Discussion
Topic: System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll
Replies: 8
Views: 3099

Re: System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll

Hi serg, sorry for the delayed reply. Yes, I'm definitely receiving the BadImageFormat exception. When you did your publish, did you specify the single-file option? Because if I publish without specifying single-file, my published project runs fine. It's only when I specify single-file = true that I...
by jrager
Wed Oct 25, 2023 12:10 am
Forum: SUB-20 General Discussion
Topic: System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll
Replies: 8
Views: 3099

Re: System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll

Thank you for your reply serg. I'm using MSVS 22 version 17.5.3 for this project. I tried your suggestion, and the build exe runs fine. I also built my sample project, and that build exe runs fine. I believe where the problem lies is in attempting to publish as a single-file executable. When I try t...
by jrager
Thu Oct 19, 2023 9:44 am
Forum: SUB-20 General Discussion
Topic: System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll
Replies: 8
Views: 3099

System.BadImageFormatException thrown by C# program using sub20dnc_v4.dll

Hello, I'm having a problem incorporating the SUB-20 library into a C# program. Program runs fine in debug. Build and publish commands run without error, but running the published exe results in a System.BadImageFormatException being thrown on call to sub20dnc_v4.dll. I'm using .Net version 7.0.203 ...