diff --git a/OpenConsole.sln b/OpenConsole.sln index 54173d9ae..32e72fddd 100644 --- a/OpenConsole.sln +++ b/OpenConsole.sln @@ -1229,7 +1229,8 @@ Global {48D21369-3D7B-4431-9967-24E81292CF63}.Release|x86.Build.0 = Release|Win32 {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|Any CPU.ActiveCfg = Release|x64 {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|ARM64.ActiveCfg = Release|ARM64 - {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|x64.ActiveCfg = Release|x64 + {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|x64.ActiveCfg = AuditMode|x64 + {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|x64.Build.0 = AuditMode|x64 {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|x86.ActiveCfg = Release|Win32 {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.Debug|Any CPU.ActiveCfg = Debug|Win32 {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.Debug|ARM64.ActiveCfg = Debug|ARM64 diff --git a/src/cascadia/WinRTUtils/LibraryResources.cpp b/src/cascadia/WinRTUtils/LibraryResources.cpp index dee269bd7..e562fafa6 100644 --- a/src/cascadia/WinRTUtils/LibraryResources.cpp +++ b/src/cascadia/WinRTUtils/LibraryResources.cpp @@ -76,7 +76,8 @@ static void EnsureAllResourcesArePresent(const ScopedResourceLoader& loader) #endif -static ScopedResourceLoader GetLibraryResourceLoader() UTILS_NONDEBUG_NOEXCEPT +static ScopedResourceLoader GetLibraryResourceLoader() +try { ScopedResourceLoader loader{ g_WinRTUtilsLibraryResourceScope }; #ifdef _DEBUG @@ -84,9 +85,12 @@ static ScopedResourceLoader GetLibraryResourceLoader() UTILS_NONDEBUG_NOEXCEPT #endif return loader; } +CATCH_FAIL_FAST() -winrt::hstring GetLibraryResourceString(const std::wstring_view key) UTILS_NONDEBUG_NOEXCEPT +winrt::hstring GetLibraryResourceString(const std::wstring_view key) +try { static auto loader{ GetLibraryResourceLoader() }; return loader.GetLocalizedString(key); } +CATCH_FAIL_FAST() diff --git a/src/cascadia/WinRTUtils/ScopedResourceLoader.cpp b/src/cascadia/WinRTUtils/ScopedResourceLoader.cpp index 4981e7fc6..e872a2d42 100644 --- a/src/cascadia/WinRTUtils/ScopedResourceLoader.cpp +++ b/src/cascadia/WinRTUtils/ScopedResourceLoader.cpp @@ -17,7 +17,7 @@ ScopedResourceLoader::ScopedResourceLoader(const std::wstring_view resourceLocat // - Gets the resource map associated with the scoped resource subcompartment. // Return Value: // - the resource map associated with the scoped resource subcompartment. -ResourceMap ScopedResourceLoader::GetResourceMap() const +ResourceMap ScopedResourceLoader::GetResourceMap() const noexcept { return _resourceMap; } diff --git a/src/cascadia/WinRTUtils/ScopedResourceLoader.h b/src/cascadia/WinRTUtils/ScopedResourceLoader.h index b92fbf4ff..f7664115e 100644 --- a/src/cascadia/WinRTUtils/ScopedResourceLoader.h +++ b/src/cascadia/WinRTUtils/ScopedResourceLoader.h @@ -7,7 +7,7 @@ class ScopedResourceLoader { public: ScopedResourceLoader(const std::wstring_view resourceLocatorBase); - winrt::Windows::ApplicationModel::Resources::Core::ResourceMap GetResourceMap() const; + winrt::Windows::ApplicationModel::Resources::Core::ResourceMap GetResourceMap() const noexcept; winrt::hstring GetLocalizedString(const std::wstring_view resourceName) const; bool HasResourceWithName(const std::wstring_view resourceName) const; diff --git a/src/cascadia/WinRTUtils/inc/LibraryResources.h b/src/cascadia/WinRTUtils/inc/LibraryResources.h index a6aadaea7..406c07e1a 100644 --- a/src/cascadia/WinRTUtils/inc/LibraryResources.h +++ b/src/cascadia/WinRTUtils/inc/LibraryResources.h @@ -49,7 +49,6 @@ namespace Microsoft::Console::Utils return pRes->resourceKey; \ }()) #define RS_(x) GetLibraryResourceString(USES_RESOURCE(x)) -#define UTILS_NONDEBUG_NOEXCEPT #else // _DEBUG @@ -57,11 +56,10 @@ namespace Microsoft::Console::Utils #define USES_RESOURCE(x) (x) #define RS_(x) GetLibraryResourceString((x)) -#define UTILS_NONDEBUG_NOEXCEPT noexcept #endif #define UTILS_DEFINE_LIBRARY_RESOURCE_SCOPE(x) \ __declspec(selectany) extern const wchar_t* g_WinRTUtilsLibraryResourceScope{ (x) }; -winrt::hstring GetLibraryResourceString(const std::wstring_view key) UTILS_NONDEBUG_NOEXCEPT; +winrt::hstring GetLibraryResourceString(const std::wstring_view key); diff --git a/src/common.build.pre.props b/src/common.build.pre.props index c906233b1..e45958d43 100644 --- a/src/common.build.pre.props +++ b/src/common.build.pre.props @@ -146,6 +146,7 @@ $(SolutionDir)\src\StaticAnalysis.ruleset true true + $(SolutionDir)\dep