diff --git a/CoreAppUWP/Pages/MainPage.xaml.cs b/CoreAppUWP/Pages/MainPage.xaml.cs index 54181ff..853fe57 100644 --- a/CoreAppUWP/Pages/MainPage.xaml.cs +++ b/CoreAppUWP/Pages/MainPage.xaml.cs @@ -13,7 +13,6 @@ using Windows.Graphics; using Windows.UI.Core; - // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. diff --git a/CoreAppUWP/Program.cs b/CoreAppUWP/Program.cs index 0417130..ec4a4c8 100644 --- a/CoreAppUWP/Program.cs +++ b/CoreAppUWP/Program.cs @@ -30,13 +30,10 @@ private static unsafe bool IsPackagedApp PWSTR str = new(); _ = PInvoke.GetCurrentPackageFullName(ref length, str); - char[] array = new char[length]; - fixed (char* ptr = array) - { - str = new(ptr); - WIN32_ERROR result = PInvoke.GetCurrentPackageFullName(ref length, str); - return result != WIN32_ERROR.APPMODEL_ERROR_NO_PACKAGE; - } + char* ptr = stackalloc char[(int)length]; + str = new(ptr); + WIN32_ERROR result = PInvoke.GetCurrentPackageFullName(ref length, str); + return result != WIN32_ERROR.APPMODEL_ERROR_NO_PACKAGE; } }