You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xamarin中File.Delete()在华为Art-AL00X设备抛出‘owner died’异常求助

华为Art-AL00X(Android 10.0 - API 29)设备上File.Delete()抛出'owner died'异常问题
  • 多数Android设备上文件删除操作可正常执行,但在华为Art-AL00X(Android 10.0 - API 29)设备调用File.Delete()时会抛出‘owner died’异常
  • 可正常创建文件并写入数据,但无法删除该文件;此问题为首次遇到,谷歌搜索未找到相关解决方案
  • 二次测试发现:若先在文件管理器中查看过该文件,则可顺利删除;未查看过的话删除就会抛出异常

相关代码

string path = "Want Save Path";
byte[] buffer = new uint8_t[73790];
using (BinaryWriter BW = new BinaryWriter(new FileStream(path, FileMode.Create)))
{
    BW.Write(buffer, 0, (int)exer.Size);
    BW.Flush();
    BW.Close();
    Console.WriteLine("USM:Save Image Data Success");
}

堆栈信息

at System.IO.FileSystem.DeleteFile (System.String fullPath) [0x00065]

in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:215

at System.IO.File.Delete (System.String path) [0x0000e]

in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.IO.FileSystem/src/System/IO/File.cs:107

at DebugTest.MyView.MainPage_OperateView.TTTFrame_Click () [0x00014]

in G:\VS2019 Projects\DebugTest\DebugTest\DebugTest\MyView\MainPage_OperateView.xaml.cs:263

内容的提问来源于stack exchange,提问作者xxpp123zz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 21:36:29