You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an issue when generating a dump in my .NET MAUI Blazor Hybrid application on .NET 8 using the Microsoft.Diagnostics.NETCore.Client library. When the app runs on Windows, it works as expected, but when running on Android, I receive the following error:
My code:
publicasyncTaskWriteDumpAsync(){stringappDataDirectory=FileSystem.AppDataDirectory;stringtimestamp=DateTime.UtcNow.ToString("yyyyMMdd_HHmmss");stringfileName=$"dump_{timestamp}.dmp";stringdumpPath=Path.Combine(appDataDirectory,"dumps");intprocessId=Process.GetCurrentProcess().Id;DiagnosticsClientclient=newDiagnosticsClient(processId);if(!Directory.Exists(dumpPath))Directory.CreateDirectory(dumpPath);DumpTypedumpType=DumpType.Normal;// Attempt to write the dumpawaitclient.WriteDumpAsync(dumpType,Path.Combine(dumpPath,fileName),logDumpGeneration:false,CancellationToken.None);}
Result on android:
Microsoft.Diagnostics.NETCore.Client.ServerNotAvailableException: Unable to connect to Process 28258. Please verify that /data/user/0/com.companyname.androiddumpgeneration/cache/ is writable by the current user. If the target process has environment variable TMPDIR set, please set TMPDIR to the same directory. Please see https://aka.ms/dotnet-diagnostics-port for more information
at Microsoft.Diagnostics.NETCore.Client.PidIpcEndpoint.GetDefaultAddress(Int32 pid)
at Microsoft.Diagnostics.NETCore.Client.PidIpcEndpoint.GetDefaultAddress()
at Microsoft.Diagnostics.NETCore.Client.PidIpcEndpoint.ConnectAsync(CancellationToken token)
at Microsoft.Diagnostics.NETCore.Client.IpcClient.SendMessageGetContinuationAsync(IpcEndpoint endpoint, IpcMessage message, CancellationToken cancellationToken)
at Microsoft.Diagnostics.NETCore.Client.IpcClient.SendMessageAsync(IpcEndpoint endpoint, IpcMessage message, CancellationToken cancellationToken)
at Microsoft.Diagnostics.NETCore.Client.DiagnosticsClient.WriteDumpAsync(DumpType dumpType, String dumpPath, WriteDumpFlags flags, CancellationToken token)
at AndroidDumpGeneration.Components.Pages.Home.WriteDumpAsync() in C:\Users\davic\OneDrive\Documentos\GitRepositories\net-maui-android-dump\AndroidDumpGeneration\Components\Pages\Home.razor:line 49
at AndroidDumpGeneration.Components.Pages.Home.GenerateDumpAsync() in C:\Users\davic\OneDrive\Documentos\GitRepositories\net-maui-android-dump\AndroidDumpGeneration\Components\Pages\Home.razor:line 25
To verify directory access, I tried writing a simple .txt file to the /data/user/0/com.companyname.androiddumpgeneration/cache/ directory from my application, and it succeeded. This confirms I have write permissions to that directory. Given that I can write files there, it suggests that the issue might be related to the dump generation library on Android rather than a permissions or environment configuration problem
Android does not support collecting memory dumps. Additionally, that PID exists in the android context - so you can't use the client library directly like that. You connect to it via TCP - not via PID-derived sockets. If you were to do this, I'd still expect a reply from the runtime saying mono runtimes don't have support for collecting memory dumps.
I've marked this item as needing documentation. I'm not sure if we publicly document that dumps are not supported on Android, so we can use this issue to track that.
I'm encountering an issue when generating a dump in my .NET MAUI Blazor Hybrid application on .NET 8 using the Microsoft.Diagnostics.NETCore.Client library. When the app runs on Windows, it works as expected, but when running on Android, I receive the following error:
My code:
Result on android:
To verify directory access, I tried writing a simple
.txt
file to the/data/user/0/com.companyname.androiddumpgeneration/cache/
directory from my application, and it succeeded. This confirms I have write permissions to that directory. Given that I can write files there, it suggests that the issue might be related to the dump generation library on Android rather than a permissions or environment configuration problemSteps to Reproduce
Expected Result:
The dump should be generated successfully on Android.
Actual Result:
A runtime error occurs, and the dump is not generated.
Configuration
Repository that demostrates the issue:
https://github.com/davicbaba/net-maui-android-dump
The text was updated successfully, but these errors were encountered: