-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Issue Description
I tried to implement the DFU on a .NET MAUI application, but it seems that when I create the DfuInstallation object and call the Start() function the process throws an Exception with a message:
java.io.FileNotFoundException:
To Reproduce
Steps to reproduce the behavior:
- Create a MAUI project using .Net 8
- Install the Laerdal.Dfu 1.27.8 NuGet package
- Create a method to download or retrieve your firmware update file
- Create the DfuInstallation object and call Start()
Expected behavior
Start and complete the DFU process with the BLE device.
** Support code **
To download the firmware file:
public async Task<bool> DownloadFirmwareFile()
{
var sqliteDataService = ServiceHelper.GetService<ISQLiteDataService>();
try
{
//Retrieve firmware file in bytes
byte[] fileBytes = await HttpClientService.Instance.GetByteArrayAsync(Constants.GetFirmwareUpdate);
//Create the file inside Android's cache directory for DFU access
string outputFilePath;
if (DeviceInfo.Current.Platform == DevicePlatform.Android)
{
outputFilePath = Path.Combine(FileSystem.Current.CacheDirectory, "app_dfu_package.zip");
}
else
{
outputFilePath = Path.Combine(FileSystem.Current.AppDataDirectory, "app_dfu_package.zip");
}
await File.WriteAllBytesAsync(outputFilePath, fileBytes);
//Check if the file exists and update the SelectedFirmwareFile
var exists = File.Exists(outputFilePath);
if (!exists)
{
Instance.SelectedFirmwareFile = null;
return false;
}
else
{
Instance.SelectedFirmwareFile = new FileInfo(outputFilePath);
return true;
}
}
catch (Exception ex)
{
Debug.WriteLine($"Exception in DownloadFirmwareFile: {ex.Message}");
return false;
}
}
Development Environment
Development Tools:
- OS: macOS Sequoia 15.4 (24E248)
- IDE: JetBrains Rider 2024.3.6
- DFU Library Version: Nordic DFU Library 1.27.167
Logs
App | File path exists: True
App | File path used: /data/user/0/com.companyname.appname/cache/app_dfu_package.zip
App | File exists: True
DfuBaseService I DFU service created. Version: 2.9.0
DfuBaseService I Starting DFU service in foreground
DfuBaseService | An exception occurred while opening file
java.io.FileNotFoundException: : open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:496)
at java.io.FileInputStream.<init>(FileInputStream.java:159)
at java.io.FileInputStream.<init>(FileInputStream.java:115)
at no.nordicsemi.android.dfu.DfuBaseService.openInputStream(DfuBaseService.java:1524)
at no.nordicsemi.android.dfu.DfuBaseService.onHandleIntent(DfuBaseService.java:1244)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:78)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:219)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8464)
at libcore.io.IoBridge.open(IoBridge.java:482)
at java.io.FileInputStream.<init>(FileInputStream.java:159)
at java.io.FileInputStream.<init>(FileInputStream.java:115)
at no.nordicsemi.android.dfu.DfuBaseService.openInputStream(DfuBaseService.java:1524)
at no.nordicsemi.android.dfu.DfuBaseService.onHandleIntent(DfuBaseService.java:1244)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:78)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:219)
at android.os.HandlerThread.run(HandlerThread.java:67)
Help Needed
If there's anything wrong with the update process, missing steps, or misconfiguration on our side, please point it out.
We’d also appreciate any suggestions or known solutions for this kind of issue.
- Is there something we might be missing?
- Are there any recent changes in the library or platform that could cause this?
- Could this be related to how we handle file paths or permissions?
Thanks in advance for your help and time!
Metadata
Metadata
Assignees
Labels
No labels