Describe the bug
I want to use Windows AI APIs in my x64 desktop app, so I need a package identity. I chose to Grant package identity by packaging with external location, but I found that it cannot run and throws an ERROR_BAD_EXE_FORMAT exception. However, arm64 programs work fine (Perhaps it's because my computer uses the arm64 architecture). In addition, packaged Apps work fine for both arm64 and x64 architectures.
Steps to reproduce the bug
- In Visual Studio, create a new C++ console application project.
- Install Nuget package: Microsoft.WindowsAppSDK, Microsoft.Windows.CppWinRT.
- Follow this tutorial to grant package identity by manually packaging with an external location.
- Write a simple Demo code:
#include <iostream>
#include <winrt/Microsoft.Graphics.Imaging.h>
#include <winrt/Microsoft.Windows.AI.Imaging.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Graphics.Imaging.h>
#include <winrt/Windows.Storage.Streams.h>
bool IsTextRecognizerReady() {
using namespace winrt::Microsoft::Windows::AI;
auto ready_state = Imaging::TextRecognizer::GetReadyState();
if (ready_state == AIFeatureReadyState::Ready ||
ready_state == AIFeatureReadyState::NotReady) {
if (ready_state == AIFeatureReadyState::NotReady) {
auto result = Imaging::TextRecognizer::EnsureReadyAsync().get();
if (result.Status() != AIFeatureReadyResultState::Success) {
return false;
}
}
} else {
return false;
}
return true;
}
int main() {
if (IsTextRecognizerReady()) {
std::cout << "TextRecognizer is ready." << std::endl;
} else {
std::cout << "TextRecognizer is not ready" << std::endl;
}
getchar();
}
- Select Solution Platform as x64, then compile and launch the application.
Expected behavior
It runs normally without throwing any exceptions.
Screenshots
The image below is a screenshot of the application running with the Solution Platform set to arm64:

However, an exception is thrown when set to x64, as shown in the image below:
NuGet package version
Windows App SDK 1.8.5: 1.8.260209005
Packaging type
Unpackaged
Windows version
Insider Build (xxxxx)
IDE
Visual Studio 2022
Additional context
- Device: Microsoft Surface Laptop, 7th Edition
- OS: Windows Insider Preview, 25H2 (26220.8062)
- CPU: Snapdragon(R) X 12-core X1E80100 @ 3.40 GHz (3.42 GHz)
- NPU: Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Hexagon(TM) NPU
Describe the bug
I want to use Windows AI APIs in my x64 desktop app, so I need a package identity. I chose to Grant package identity by packaging with external location, but I found that it cannot run and throws an
ERROR_BAD_EXE_FORMATexception. However, arm64 programs work fine (Perhaps it's because my computer uses the arm64 architecture). In addition, packaged Apps work fine for both arm64 and x64 architectures.Steps to reproduce the bug
Expected behavior
It runs normally without throwing any exceptions.
Screenshots
The image below is a screenshot of the application running with the Solution Platform set to arm64:

However, an exception is thrown when set to x64, as shown in the image below:
NuGet package version
Windows App SDK 1.8.5: 1.8.260209005
Packaging type
Unpackaged
Windows version
Insider Build (xxxxx)
IDE
Visual Studio 2022
Additional context