Skip to content

Commit

Permalink
Fix settings page crash on Windows 10 (#1480)
Browse files Browse the repository at this point in the history
## Description
On Windows 10, it does not seem to load
`Microsoft.WindowsAppRuntime.Insights.Resource.dll` and this crash the
app. Added a fallback for this.

## Motivation and Context
Closes #1477 

## How Has This Been Tested?
Manual

## Screenshots (if appropriate):

![image](https://github.com/microsoft/WinUI-Gallery/assets/42881734/70aa186c-4c53-4dce-b989-62dd04c3dcbe)

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
  • Loading branch information
HO-COOH authored Apr 25, 2024
1 parent 9537184 commit 0cea53d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions WinUIGallery/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,19 @@ public static string WinAppSdkRuntimeDetails
{
get
{
// Retrieve Windows App Runtime version info dynamically
var windowsAppRuntimeVersion =
from module in Process.GetCurrentProcess().Modules.OfType<ProcessModule>()
where module.FileName.EndsWith("Microsoft.WindowsAppRuntime.Insights.Resource.dll")
select FileVersionInfo.GetVersionInfo(module.FileName);
return WinAppSdkDetails + ", Windows App Runtime " + windowsAppRuntimeVersion.First().FileVersion;
try
{
// Retrieve Windows App Runtime version info dynamically
var windowsAppRuntimeVersion =
from module in Process.GetCurrentProcess().Modules.OfType<ProcessModule>()
where module.FileName.EndsWith("Microsoft.WindowsAppRuntime.Insights.Resource.dll")
select FileVersionInfo.GetVersionInfo(module.FileName);
return WinAppSdkDetails + ", Windows App Runtime " + windowsAppRuntimeVersion.First().FileVersion;
}
catch
{
return WinAppSdkDetails + $", Windows App Runtime {WASDK.Runtime.Version.Major}.{WASDK.Runtime.Version.Minor}";
}
}
}

Expand Down

0 comments on commit 0cea53d

Please sign in to comment.