View Full Version : Error at LoadDeviceStateFromFile(): Passed data does not fit to the compressor

October 11, 2011, 13:41:05
Windows XP Embedded
Imaging Control dll:

Hello all,

We create a small WinForms program with the composant ICImagingControl32, and installed on a device with a camera to have Live.

When we lauch the program from Desktop, the ICImagingControl32 displays correctly the image live.
But when Windows XP launchs it directly from AutoWinLogon, the LoadDeviceStateFromFile() throws an exception "Passed data does not fit to the compressor".

Is anybody knows what is this error?
And why it comes only when the program is launched in AutoWinLogon mode at startup?

Thank you,

Stefan Geissler
October 11, 2011, 14:41:10

Maybe the start of your program is before the system has identified and loaded all necessary devices and their drivers. It take some time, after a device has been detected until all necessary files of the driver are loaded. Therefore, e.g. the KsPropertySet is not available when you try to send parameters to your device.

A possible solution is to wrap the LoadDeviceState block into a try...catch block. In the catch block, simply sleep for 500ms. Put this in a loop. In this loop allow a few tries, until your application ends. This should do the job. Your program can react more flexible on loading times at Windows start.

October 11, 2011, 15:05:58
Hello Stefan,

We placed the LoadDeviceStateFromFile() function into a try/catch block in a Windows.Form.Timer function that is called after 500 milliseconds. And the timer is called again if the LoadDeviceStateFromFile() function throws an exception.
Sadly, after 10 minutes after having launched the program, the Windows.Form.Timer is still called because LoadDeviceStateFromFile() continues to throw an exception.

Do you know what means the error "Passed data does not fit to the compressor"?

Thank you,

Stefan Geissler
October 11, 2011, 17:16:25

the "Passed data does not fit to the compressor" is misleading at "LoadDeviceState" unfortunately. However, this error message means, that it was tried to set a parameter of your camera, which was not available or out of range. This points to the problem, that the driver was not fully loaded, when you started your program. You may post your camera initialization function here.

I would like to suggest to try a delay in program loading, so the program is not loaded as soon as possible. Usually a second will be enough.

Windows XP needs a little time, until all files are loaded correctly.

Stefan Geissler
October 11, 2011, 17:19:55

Just an addition: Please check, whether the path to the XML file can be found. I had a similar case today.

October 12, 2011, 08:14:58
Hello Stefan,

Given the absolute path of the XML configuration file to LoadDeviceStateFromFile() resolved the problem.

Thank you!

Stefan Geissler
October 12, 2011, 09:14:22
Hello Alain,

first of all, I have to apologize for the misleading error message in IC Imaging Control .NET. I think, it is a good idea to create some better error messages.

Also I would like to say, that using an absolute path may is not working in any cases. Especially, if you use localized Windows versions, some path names will differ. You have two options: In the link you use for auto start you can set the working directory of your application. This is the simple way, without changing your program code.

The other way is to query the program's directory:

using System.IO;
using System.Windows.Forms;

string appPath = Path.GetDirectoryName(Application.ExecutablePath);

icImagingControl1.LoadDeviceStateFromFile(Path.Com bine(appPath,"device.xml"), true);

This should work fine, if the file containing the device configuration is located in the same directory like the program.