dymosoftware / DCD-SDK-Sample

DYMO Connect SDK Samples
Other
60 stars 26 forks source link

NullReferenceException when retrieving printers #63

Closed jonokie closed 1 year ago

jonokie commented 2 years ago

I am getting a NullReferenceExeption when calling the following: DymoSDK.Implementations.DymoPrinter.Instance.GetPrinters();

Here's the call stack: DYMO.LabelAPI.Windows.Printers.SpoolerMonitorGateway.SpoolerMonitorGateway() DYMO.LabelAPI.Windows.PrinterDiscovery.WindowsDeviceDiscoveryAgent.WindowsDeviceDiscoveryAgent()

jonokie commented 1 year ago

Never mind. There were files missing in the compile-to folder.

ksladowski commented 1 year ago

What files were missing? I've added every dll I could find in the package and still happening.

jonokie commented 1 year ago

I do not remember specific files that were missing. I removed all references to Dymo, cleaned my solution, and re-added the references. After that, I had to go through their package folders and hand-pick files to copy to my target folder.

ksladowski commented 1 year ago

Any chance you could show me the reference list for the project? I've removed all Dymo references and restarted this process twice now

image

jonokie commented 1 year ago

image

Target folder: image

jonokie commented 1 year ago

I would check to make sure the platform-specific files you have referenced and/or copied into your bin folder match your project's platform setting. If you are targeting "AnyCPU", try changing that to "x86" (or vice-versa) and see if it works. If it does, that tells you have 32-bit dependencies even through you are targeting 64-bit (or vice versa).