Doing UWP development, when you’ve been doing WPF/WinForms development for years, can cause some confusion sometimes.
A colleague of mine got stuck when trying to launch the default application for a particular file he generated in code:
var file = await savePicker.PickSaveFileAsync(); System.Diagnostics.Process.Start(file.Path)
Now, although devs who have been doing .NET development might easily think the above code looks OK, it doesn’t work, all it does is throwing an AccessDenied exception.
Note that UWP apps are running sandboxed, so you are not allowed to use Proccess.Start.
You should be using the Windows.System.Launcher api to do this in UWP instead:
Leave a Reply