System.UnauthorizedAccessException вызывается в нашем приложении Xamarin iOS при чтении общего файла из другого приложения или через общедоступную папку.
Эта ошибка новый и начался после обновления с VS2019 до VS2022 (Windows). Также было несколько обновлений macOS (сейчас Ventura 13.7). Код обмена работает нормально, но, похоже, отсутствуют настройки безопасности. Надеемся, это простая оплошность.
Ниже приведены фрагменты из приложения. Есть предложения, с чего начать поиск причины?
info.plist:
CFBundleTypeName
Public plain-text
LSItemContentTypes
public.plain-text
AppDelegate.cs:
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
MyModule mm = new MyModule();
mm.AddFile(url.Path);
return true;
}
MyModule.cs:
public class MyModule
{
public void AddFile(string url)
{
...
var text = File.ReadAllText(url); >
...
}
}
Сообщение об исключении:
{System.UnauthorizedAccessException: Access to the path "/private/var/mobile/Containers/Shared/AppGroup/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/File Provider Storage/xxxxx.txt" is denied.
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0026e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.IO/FileStream.cs:274
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.IO/FileStream.cs:106
at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) [0x00055] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/IO/StreamReader.cs:182
at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/IO/StreamReader.cs:167
at System.IO.File.InternalReadAllText (System.String path, System.Text.Encoding encoding) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.IO.FileSystem/src/System/IO/File.cs:303
at System.IO.File.ReadAllText (System.String path) [0x00026] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.IO.FileSystem/src/System/IO/File.cs:282
at [App].MyModule.AddFile (System.String fullPath) [0x00002] in C:\xxxx\...\xxxx.cs:187 }
Подробнее здесь: https://stackoverflow.com/questions/791 ... denied-rea
Xamarin iOS System.UnauthorizedAccessException: доступ к пути запрещен при чтении общих файлов ⇐ C#
Место общения программистов C#
1730387398
Anonymous
System.UnauthorizedAccessException вызывается в нашем приложении Xamarin iOS при чтении общего файла из другого приложения или через общедоступную папку.
Эта ошибка новый и начался после обновления с VS2019 до VS2022 (Windows). Также было несколько обновлений macOS (сейчас Ventura 13.7). Код обмена работает нормально, но, похоже, отсутствуют настройки безопасности. Надеемся, это простая оплошность.
Ниже приведены фрагменты из приложения. Есть предложения, с чего начать поиск причины?
info.plist:
CFBundleTypeName
Public plain-text
LSItemContentTypes
public.plain-text
AppDelegate.cs:
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
MyModule mm = new MyModule();
mm.AddFile(url.Path);
return true;
}
MyModule.cs:
public class MyModule
{
public void AddFile(string url)
{
...
var text = File.ReadAllText(url); >
...
}
}
[b]Сообщение об исключении:[/b]
{System.UnauthorizedAccessException: Access to the path "/private/var/mobile/Containers/Shared/AppGroup/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/File Provider Storage/xxxxx.txt" is denied.
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0026e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.IO/FileStream.cs:274
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.IO/FileStream.cs:106
at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) [0x00055] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/IO/StreamReader.cs:182
at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/IO/StreamReader.cs:167
at System.IO.File.InternalReadAllText (System.String path, System.Text.Encoding encoding) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.IO.FileSystem/src/System/IO/File.cs:303
at System.IO.File.ReadAllText (System.String path) [0x00026] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.IO.FileSystem/src/System/IO/File.cs:282
at [App].MyModule.AddFile (System.String fullPath) [0x00002] in C:\xxxx\...\xxxx.cs:187 }
Подробнее здесь: [url]https://stackoverflow.com/questions/79145259/xamarin-ios-system-unauthorizedaccessexception-access-to-the-path-is-denied-rea[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия