Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Managed System Dialog crash with System.UnauthorizedAccessException, again #8437

Closed
fnajera-rac-de opened this issue Jul 4, 2022 · 0 comments · Fixed by #13683
Closed

Managed System Dialog crash with System.UnauthorizedAccessException, again #8437

fnajera-rac-de opened this issue Jul 4, 2022 · 0 comments · Fixed by #13683
Labels
bug help-wanted A contribution from the community would be most welcome.

Comments

@fnajera-rac-de
Copy link

The bug #4171 is not completely fixed by #4181.

It is possible to have an IsReady drive for which you do not have access. In that context, operations like VolumeLabel will fail and the process crashes.

var mountVolInfos = allDrives
.Where(p =>
{
try
{
var ret = p.IsReady;
return ret;
}
catch (Exception e)
{
Logger.TryGet(LogEventLevel.Warning, LogArea.Control)?.Log(this, $"Error in Windows drive enumeration: {e.Message}");
}
return false;
})
.Select(p => new MountedVolumeInfo()
{
VolumeLabel = string.IsNullOrEmpty(p.VolumeLabel.Trim()) ? p.RootDirectory.FullName
: $"{p.VolumeLabel} ({p.Name})",
VolumePath = p.RootDirectory.FullName,
VolumeSizeBytes = (ulong)p.TotalSize
})
.ToArray();

See the .Dump() from LINQPad for such a drive:

image

To reproduce I guess you need to have a network share that you control and map, and for which you can revoke permission for your user.

Tested with 0.10.15

@maxkatz6 maxkatz6 added the help-wanted A contribution from the community would be most welcome. label Jul 4, 2022
maxkatz6 added a commit that referenced this issue Nov 22, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 22, 2023
* Update Avalonia.Controls.Platform.Dialogs apis

* Enable nullable on dialogs project

* Implement ManagedFileChooserOverwritePrompt with new styles, instead of hardcoding prompt creation

* Add BclMountedVolumeInfoProvider fallback

* Update samples page to include ShowOverwritePrompt

* ManagedStorageProvider with different window and popup implementations

* Extend ManagedFileDialogOptions

* Fix #8437 because I can

---------

Co-authored-by: Jumar Macato <16554748+jmacato@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help-wanted A contribution from the community would be most welcome.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants