Repository navigation
Closed
Description
Tool
Visual Studio extension
Description
I'm trying to debug a simple nanoframework program using vscode in macos and I get the below error
[NanoRuntime] Starting debug session for /Users/xxxx/Projects/xxxx/hackathon/mantis/mantis/bin/Debug
[NanoBridge] Starting bridge process: /Users/xxxx/.vscode-insiders/extensions/nanoframework.vscode-nanoframework-1.0.247/bin/nanoDebugBridge/darwin-arm64/nanoFramework.Tools.DebugBridge
[NanoBridge] Sending: {"command":"initialize","id":1,"args":{"device":"/dev/cu.usbserial-A5069RR4","verbose":false,"verbosity":"information"}}
[NanoBridge] Sending: {"command":"getThreads","id":2,"args":{}}
[NanoBridge] Received: {"event":"output","body":{"category":"console","output":"[nF-Debug] Verbosity level set to: Information\n"}}
[nF-Debug] Verbosity level set to: Information
[NanoBridge] Bridge stderr: [DebugBridge:Info] Verbosity level set to: Information
[NanoBridge] Received: {"id":1,"success":true,"error":null,"data":{"version":"1.0.0","capabilities":["breakpoints","variables","stepping"]}}
[NanoBridge] Sending: {"command":"connect","id":3,"args":{"device":"/dev/cu.usbserial-A5069RR4"}}
[NanoBridge] Received: {"id":2,"success":true,"error":null,"data":[]}
[NanoBridge] Received: {"event":"output","body":{"category":"console","output":"[nF-Debug] Connecting to device: /dev/cu.usbserial-A5069RR4 at baud rate 921600\n"}}
[nF-Debug] Connecting to device: /dev/cu.usbserial-A5069RR4 at baud rate 921600
[NanoBridge] Bridge stderr: [DebugBridge:Always] Connecting to device: /dev/cu.usbserial-A5069RR4 at baud rate 921600
[NanoBridge] Bridge stderr: Fatal error.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
[NanoBridge] Bridge stderr: at System.Nullable`1[[System.Threading.CancellationToken, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].get_HasValue()
at nanoFramework.Tools.Debugger.NFDevice.GlobalExclusiveDeviceAccess.GetOrCreate(System.String, Int32, System.Nullable`1<System.Threading.CancellationToken>)
at nanoFramework.Tools.Debugger.NFDevice.GlobalExclusiveDeviceAccess.TryGet(System.String, Int32, System.Nullable`1<System.Threading.CancellationToken>)
at nanoFramework.Tools.Debugger.PortSerial.DeviceWatcher+<>c__DisplayClass22_1+<<StartWatcher>b__2>d.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[nanoFramework.Tools.Debugger.PortSerial.DeviceWatcher+<>c__DisplayClass22_1+<<StartWatcher>b__2>d, nanoFramework.Tools.DebugLibrary.Net, Version=2.5.0.0, Culture=neutral, PublicKeyToken=e520bb6b53f04733]].ExecutionContextCallback(System.Object)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[nanoFramework.Tools.Debugger.PortSerial.DeviceWatcher+<>c__DisplayClass22_1+<<StartWatcher>b__2>d, nanoFramework.Tools.DebugLibrary.Net, Version=2.5.0.0, Culture=neutral, PublicKeyToken=e520bb6b53f04733]].MoveNext(System.Threading.Thread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[nanoFramework.Tools.Debugger.PortSerial.DeviceWatcher+<>c__DisplayClass22_1+<<StartWatcher>b__2>d, nanoFramework.Tools.DebugLibrary.Net, Version=2.5.0.0, Culture=neutral, PublicKeyToken=e520bb6b53f04733]].ExecuteFromThreadPool(System.Threading.Thread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
[NanoBridge] Bridge process exited with code null
[NanoRuntime] Disconnecting (terminate: false)
[NanoBridge] Sending: {"command":"disconnect","id":4,"args":{"terminateDebuggee":false}}
How to reproduce
- In macOS, Install Visual Studio Code Insiders
- Add .NET nanoFramework pre-release vs code extension (latest)
- A simple program as shown below
using System;
using System.Threading;
using System.Diagnostics;
namespace simpleapp
{
public class Program
{
public static void Main()
{
Debug.WriteLine("Hello from nanoFramework!");
Console.WriteLine("Hello from nanoFramework!");
}
}
}- Connect to ESP32_REV3 and flash and deploy the above program
- Flash -
nanoff flash --target ESP32_REV3 --fwversion 2.0.0-preview.391 --preview --serialport /dev/tty.usbserial-A5069RR4 --masserase - Deploy -
esptool --port /dev/cu.usbserial-A5069RR4 write-flash 0x1E0000 "/Users/xxxx/Projects/xxxx/hackathon/mantis/simpleapp/bin/Debug/simpleapp.bin" - Start Debugging
Expected behaviour
Break point should be hit and debugging has to work.
Screenshots
No response
Aditional context
.NET 10
Visual Studio Code Insiders Version: 1.136.0-insider
macOS Tahoe Version 26.6.1
nanoff --version 3.0.0-preview.1
nanoFramework pre-release vs code extension 1.0.249
Discord Link - https://discord.com/channels/478725473862549535/1542614194904367255/1542881804527345774
Activity
Ellerbach commentedon Aug 30, 2026
Just a quick question: as you are flashing your device with preview (so the development branch containing generics), the project must also be of the preview type with mscorelib and all the other libs as preview.
fingers10 commentedon Aug 30, 2026
Can you please help me understand what I'm missing? do I need to run any extra commands to do that?
nfproj:
packages.config:
alberk8 commentedon Aug 31, 2026
just flash the stable firmware
nanoff flash --target ESP32_REV3 --update --serialport /dev/tty.usbserial-A5069RR4 --masserasejosesimoes commentedon Sep 24, 2026
@fingers10 are you still having issues using the latest version?
fingers10 commentedon Sep 24, 2026
Yep I'm good. It's working.