Serial Port Not Working While Not Debugging

I’ven working in a project that demands Serial Communication. I’ve implemented an application that works perfectly while the Device, and its applications is attached to the laptop, while i’m debugging. But once I start the application in a non debugging mode, the serial communication does not work properly. Any one got an idea about how confusing could it be. I don’t know why is this happening. Ive tryed to research byte adding some kind of Log, or stuff like that, but nothing is able to let me ind the problem. But once I start the application from the debugger, everithing works fine.
Any Idea about what is happenning?
I know the proble is in serial communication, because I can sar a Serial port with no probles, but, i don’t get any response from the plugged device when i try to write to it.
Thank you in advance.
PD:I have everything updated.

so here’s my first thought - you have a serial port grounding issue.

How are you supplying power when you are not connected to the debugger? Could it be that you have not connected the two device GNDs together but when on a USB cable it grounds them to common GND? What is the second device connected to your CWX ?

Are you catching all your exceptions ?

The second device is a fingerprint reader. I’ve already catched the exceptions that may occur. In addition, I’m working with a parallel cable to link the chipwprkX to the reader, caring about the way is wired. I thought maybe, the problem could be about power supply, but it isn’t, even the device is not debugging it is still connected via USB, and there is a 12W, 4A DC source feeding the chipworkX

Thank you about the ideas.

Hello again, I was thinking about the way how I instance my port. Are there some considerations about the order that I add the event handlers and I open the port? Do I need to define the instance as an static object? May I instance it at the main method of my application, or can I instance it at some point during the program execution.
Thank you in advance

First open the port, then subscribe to the event.

What Eric said…

There’s a bug in NETMF that allows you to do either order on COM1 but you have to do it in the right order for other COM ports. This is supposed to be fixed in NETMF 4.2. There’s another thread (or two) about this somewhere…

I was testing and making some changes, but seems that it is not the problem. I still being not able to start serial communication in a non debugged context.
Thank you again.
I’ll be ancious waiting for new ideas.

Did you try deploying a “Release” version of your project to the device? I’ve noticed similar differences before between “Debug” versions and “Release” versions.

Make sure that you Open() the serial port before you subscribe to serial port events.