Skip to content

ApplicationLanguages::PrimaryLanguageOverride will throw an exception that can't be caught if it has never been set before #6346

@hoshiizumiya

Description

@hoshiizumiya

Describe the bug

I used Windows SDK PrimaryLanguageOverride api, because it doesn't work in the wasdk.

Image Exception thrown at 0x00007FFB1B3FB5AC in OpenNet.exe: Microsoft C++ exception: long at memory location 0x000000C3423FD068.

PrimaryLanguageOverride is empty(NOT SET)

'OpenNet.exe' (Win32): Loaded 'C:\Windows\System32\Winlangdb.dll'. Symbol loading disabled by Include/Exclude setting.
Exception thrown at 0x00007FFB1B3FB5AC in OpenNet.exe: Microsoft C++ exception: long at memory location 0x000000C33473C088.

Exception thrown at 0x00007FFB1B3FB5AC in OpenNet.exe: Microsoft C++ exception: long at memory location 0x000000C33473C088.

Steps to reproduce the bug

		try
		{
			m_initialLanguageOverride = ApplicationLanguages::PrimaryLanguageOverride();

			if (m_initialLanguageOverride.empty())
			{
				OutputDebugStringW(L"PrimaryLanguageOverride is empty(NOT SET)\n");
			}
		}
		catch (const winrt::hresult_error& e)
		{
#ifdef _DEBUG
			std::wstring msg = L"WinRT Exception: ";
			msg += e.message().c_str();
			msg += L"\n";
			OutputDebugStringW(msg.c_str());
#endif
		}
#ifdef _DEBUG
		OutputDebugStringW((m_initialLanguageOverride + L"\n").c_str());
#endif

Expected behavior

I do not think it is normal.

Screenshots

No response

NuGet package version

1.8.260317003

Packaging type

Packaged (MSIX)

Windows version

Insider Build (xxxxx)

IDE

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions