TinyCLR OS USB Debugging not working


We are currently developing our updated electronics coming from G400S to the SC20260E.

Our electronics power up fine and we manage to communicate with the SoM via USB with Visual Studio 2022 and TinyCLRConfig tool.
We began by migrating our old netmf software to TinyCLR OS and migrating hardware pins to the new SoM.
We manage to set breakpoints properly but debugging to the console does not appear on the ouput window in VS2022.
USB Debug interface is selected.

We are testing this code as recommended in the TinyCLR OS docs.

                if (DeviceInformation.DebugInterface == DebugInterface.Usb)
                    System.Diagnostics.Debug.WriteLine("Debug is in USB mode");

However “Debug is in USB mode” does not appear on the Ouput console. We are not able to debug our updated hardware because of this.

Any tips?

Thank you.

Do you mean “System.Diagnostics.Debug.WriteLine” doesn’t work?

if (DeviceInformation.DebugInterface == DebugInterface.Usb)
                    System.Diagnostics.Debug.WriteLine("Debug is in USB mode");
            System.Diagnostics.Debug.WriteLine("Value:  " + DeviceInformation.DebugInterface .ToString());

I mean USB debugging does not show debug messages on the ouput window

Do you have a Thread.Sleep(Timeout.Infinite) statement at the end of your main() code.

You might be exiting main before TinyClr has had a chance to write out the debug message.

We have several threads running infinitely as this code comes from out old released hardware.
Thing is I am able to set breakpoints and debug those lines of code, but no Debug messages are printed to the output console.

Send me a simple project that we can reproduce. Are you sure the code is executed? The breakpoint is in red, not yellow.

Also check on assemblies references, make sure all assemblies are loaded.

Make simple helloworld project…

I managed to print debug messages to the console by installing TinyCLR USB nuget packages and enabling DEBUG constant in project build properties.


So everything good now? I see writeline does work on your output.

Yes everything now work as intended

1 Like