How do I resolve the following Exception...?

CDev-8220 425 Reputation points
2025-08-06T14:07:48.4966667+00:00

Exception thrown at 0x00007FFA4A457F9A (KernelBase.dll) in App.exe: WinRT originate error - 0x8000FFFF : 'WindowsXamlManager and DesktopWindowXamlSource are supported for apps targeting Windows version 10.0.18226.0 and later. Please check either the application manifest or package manifest and ensure the MaxTestedVersion property is updated.'. 'App.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. Symbol loading disabled by Include/Exclude setting. App.exe!00007FF613E051EB: LogHr(1) tid(1104) 8000FFFF Catastrophic failure Exception thrown at 0x00007FFA4A457F9A in App.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000847FD1D678. The program '[4332] App.exe' has exited with code 0 (0x0).

The project uses the latest installed version, which was 10.0.26100.4188

targetVersion

However, I tried using an earlier version, and so, installed 10.0.20348.0, and retargeted to that.

targetsAvailable

When I do, this results in other errors, since header files windows.ui.interop.h and presentation.h are no longer available.

I created an app.manifest.xml file in the project.

<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
	<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
		<application>
			<!-- Windows 10, version 1903 or greater -->
			<maxversiontested Id="10.0.26100.4188"/>
			<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
		</application>
	</compatibility>
</assembly>

I set the properties.

properties

However, I am getting the same errors.

What do I do to resolve these?

Developer technologies | C++
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Darran Rowe 2,171 Reputation points
    2025-08-06T17:39:17.1866667+00:00

    I just use:

      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
          <!-- Windows 10-->
          <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
          <maxversiontested Id="10.0.22621.0" />
        </application>
      </compatibility>
    

    It turns out that the version in maxversiontested isn't that important, the presence of the element is.

    One other thing to try is see if the application manifest contains the maxversiontested element. The manifest can be extracted from the executable using mt, which is part of the Windows SDK.

    enter image description here

    This must contain the compatibility information that you entered, and it is an xml file.


  2. Varsha Dundigalla(INFOSYS LIMITED) 795 Reputation points Microsoft External Staff
    2025-08-07T07:38:03.87+00:00

    Thanks for sharing details. Please find the steps below.

    1. Fix the manifest file

    Replace your app.manifest.xml with this

     `<?xml version="1.0" encoding="utf-8"?>

    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">

    <application>

    <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>

    <maxversiontested Id="10.0.26100.4188"/>

    </application>

    </compatibility>

    <application xmlns="urn:schemas-microsoft-com:asm.v3">

    <windowsSettings>

    </windowsSettings>

    </application>

    </assembly>

    Make sure this manifest file is:

    • Added to your project
    • Set to "Content" and "Copy Always" in its properties

    2. Use the latest Windows SDK

    Steps:

    • Open Visual Studio
    • Right-click your project > Properties
    • Under General > Windows SDK Version, select 10.0.26100.4188
    • Apply the same SDK across all projects in the solution
    • Uninstall older SDKs to avoid confusion

    3. Set correct manifest tool settings

    In Project Properties > Manifest Tool:

    • Additional Manifest Files: app.manifest.xml
    • Embed Manifest: Yes
    • Generate Manifest: No
    • DPI Awareness: Per Monitor High DPI Aware

    4. Initialize XAML safely in code

    Use this C++/WinRT code to check API availability before initializing:
    #include <winrt/Windows.Foundation.h>

    #include <winrt/Windows.Foundation.Metadata.h> #include <winrt/Windows.UI.Xaml.Hosting.h

    #
    #
    #
    int main() {
        winrt::init_apartment(winrt::apartment_type::single_threaded);
    
        if (winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(
            L"Windows.Foundation.UniversalApiContract", 8))
        {
            auto manager = winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread();
            // Safe to use DesktopWindowXamlSource
        }
    
        return 0;
    }
    

    5. Verify runtime environment

    • Ensure the system is Windows 10 version 1903 (build 18362) or newer
    • Install the VC++ runtime from Microsoft’s website
      Let me know if you need any help with this.
      Let us know if the issue persists after following these steps. We’ll be happy to assist further if needed.

  3. Varsha Dundigalla(INFOSYS LIMITED) 795 Reputation points Microsoft External Staff
    2025-08-08T07:29:02.0233333+00:00

    Thank you for sharing details. Please find the steps below.

    Fix Manifest Not Embedding in Win32/XAML Islands

    This resolves the 0x8000FFFF error caused by WindowsXamlManager and DesktopWindowXamlSource failing due to missing or improperly embedded manifest data.

    1. Correct Project Settings

    app.manifest file:

    • Item Type: Manifest
    • Content: False
    • Copy to Output Directory: Do not copy

    Project Properties → Linker:

    • Generate Manifest: No
    • Ignore Import Library: Yes
    • Additional Dependencies: app.res (if using .rc method below)

    Project Properties → Manifest Tool:

    • Additional Manifest Files: app.manifest
    • Embed Manifest: Yes
    • Generate Manifest: No
    • DPI Awareness: Per Monitor High DPI Aware
    • Use FAT32 Workaround: Yes

    Add to your source file (e.g., main.cpp) or .vcxproj:

    #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
    
    1. Nuclear Clean Rebuild
    # Close Visual Studio
    # Delete these folders from your project root:
    Remove-Item -Recurse -Force .\bin, .\obj, .\.vs, .\ipch
    Remove-Item *.sdf, *.cache
    
    # Clear MSBuild cache
    Remove-Item -Recurse -Force "$env:LocalAppData\Microsoft\MSBuild\"
    
    # Restart Visual Studio as Administrator
    
    1. Runtime Manifest Verification

    Add this to the top of your main source file:

    #include <Windows.h>
    #include <fstream>
    
    void VerifyManifestEmbedding() {
        HRSRC hRes = FindResource(nullptr, MAKEINTRESOURCE(1), RT_MANIFEST);
        if (!hRes) {
            MessageBox(nullptr, L"Manifest resource not found!", L"Fatal Error", MB_ICONERROR);
            ExitProcess(1);
        }
    
        HGLOBAL hData = LoadResource(nullptr, hRes);
        LPVOID pData = LockResource(hData);
        DWORD size = SizeofResource(nullptr, hRes);
    
        std::string manifest(static_cast(pData), size);
        if (manifest.find("10.0.26100.4188") == std::string::npos) {
            std::ofstream("manifest_dump.xml") << manifest;
            MessageBox(nullptr,
                L"Wrong manifest embedded! Saved as manifest_dump.xml",
                L"Configuration Error", MB_ICONERROR);
            ExitProcess(1);
        }
    }
    
    // Call this FIRST in wWinMain:
    VerifyManifestEmbedding();
    
    1. Post-Build Verification

    Add this PowerShell script as a Post-Build Event:

    $mt = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.26100.4188\x64\mt.exe"
    & $mt -inputresource:"$(TargetPath);#1" -out:"$(TargetDir)embedded.manifest"
    findstr /C:"10.0.26100.4188" "$(TargetDir)embedded.manifest" || (
        echo ERROR: Manifest not embedded correctly!
        exit 1
    )
    
    1. The Nuclear Option (If Still Failing)

    Create app.rc with:

    1 RT_MANIFEST "app.manifest"
    

    Add to project:

    • Item Type: Resource Compiler

    Project Properties → Linker → Input:

    • Additional Dependencies: app.res

    Add to code:

    #pragma comment(linker, "/manifest:no")
    

    Why This Works

    • Project Settings Fix – Stops Visual Studio from overwriting your manifest.
    • Clean Rebuild – Removes all cached/broken builds.
    • Runtime Check – Immediately stops if the wrong manifest is embedded.
    • Post-Build Script – Verifies the manifest before you even run the app.
    • Direct Resource Embedding – Forces the manifest into the .exe without relying on Visual Studio’s manifest tool.
    • Manifest Dependency Declaration – Ensures OS compatibility is declared at link time.

    Let us know if the issue persists after following these steps. We’ll be happy to assist further if needed.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.