Skip to content

Getting Null Exception #69

@gregg-veemac

Description

@gregg-veemac

Hi

Hoping someone here can help me. I have the following code but when I try to upload the sketch, I get a null exception. I've verified the file name is correct and the port is correct. The board I'm using is a Nano 33 BLE, and I've tried various ArduinoModels but I get the same results with each one.

This is the code:

NLogArduinoUploaderLogger log = new NLogArduinoUploaderLogger();
Progress progress = new Progress(p => log.Info($"Upload progress: {p}%"));

var uploader = new ArduinoSketchUploader(
new ArduinoSketchUploaderOptions()
{
FileName = @"C:\Testing\Nano_33_BLE_sketch_20250612114853.ino.hex",
PortName = "COM4",
ArduinoModel = ArduinoModel.NanoR3
}, log, progress);

uploader.UploadSketch();

Here are the exception details:

System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=ArduinoUploader
StackTrace:
at ArduinoUploader.BootloaderProgrammers.ResetBehavior.ResetThroughTogglingDtrRtsBehavior.Reset(SerialPortStream serialPort, SerialPortConfig config)
at ArduinoUploader.BootloaderProgrammers.ArduinoBootloaderProgrammer.Close()
at ArduinoUploader.ArduinoSketchUploader.UploadSketch(IEnumerable`1 hexFileContents)
at ArduinoUploader.ArduinoSketchUploader.UploadSketch()
at PeskyMVC.winULVController.UploadNewSketch(String filename, String port) in C:\Users\gregg\source\repos\gregg-veemac\PeskyMVC\winULVController.xaml.cs:line 63

This exception was originally thrown at this call stack:
[External Code]
PeskyMVC.winULVController.UploadNewSketch(string, string) in winULVController.xaml.cs

Thank you and I appreciate the help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions