Application crashes

Feb 11, 2012 at 4:59 PM
Edited Feb 12, 2012 at 8:01 PM

Hi,
I tried to use that lib but unfortunatelly it could not work for me.
I have a full trusted SL4 OOB app where SLSerialPort is registered. The COM object is successfully installed on that machine and shown in the VMI as well.
(the application on the Home screen also can see the installed COM object)
My device is an RFID Card Reader (Parallax #28340 - USB serial port version) .
The serial port could be opened (visual feedback is appeared on device) but when I put on the card the application crashes without any error. Definitely it occurs when the incoming data is readed and seems to me it happens on the background thread and destroy the UI thread too.
Cardreader and the card are working perfectly with same settings in a WinForms application and in Putty, too. (on Windows7)
I have tried to debug but I was not success with it.
I cannot try the reading on the Home screen app because the port cannot be opened (maybe dtrenable is false).
Do you have any idea how can I find the reason of this failure?
My code:

port = new System.IO.Ports.SerialPort("COM17", 2400, System.IO.Ports.Parity.None, 8);
port.StopBits = System.IO.Ports.StopBits.One;
port.Handshake = System.IO.Ports.Handshake.None;
port.ReadTimeout = 2000; 
port.DtrEnable = true; 
port.ReceivedBytesThreshold = 12; 
port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(port_DataReceived);
port.ErrorReceived += new System.IO.Ports.SerialErrorReceivedEventHandler(port_ErrorReceived);
port.Open();
... 

Any help is apprechiated.
Thanks in advance,
sosenk

 

Coordinator
Feb 13, 2012 at 4:04 PM
Edited Feb 13, 2012 at 4:08 PM

Hi sosenk,

this seems to happen to some people periodically (seems like the same error abowne encountered.

I did not find the issue either. There is one machine at my work's office that behaves the same (and I could not find the reason until now). All other machines I ever installed and tried never show this weird behavior.

Unfortunately I do not really know how to debug p/invoke stuff. The problem is, that both components work, if you test them seperately.

Have you unblocked the download-file before installing the libs? Or did you compile the sources to get the COM object installed?

 

Regards,

Paul

edit: corrected link to other discussion

Feb 13, 2012 at 5:41 PM

Hi,
Thanks for your answer.
Yes, I tried first with your original and unblocked version and then I tried with a rebuilded version too. Neither worked.
Best regards,
sosenk