How to fix the issue of failing the Windows App Certification Kit scan?

sambo jos 0 Reputation points
2025-12-30T11:56:09.1733333+00:00

操作系统版本检查测试

失败

正确的操作系统版本检查

  • 发现错误: 正确操作系统版本检查测试检测到以下错误:
    • System.NullReferenceException: 未将对象引用设置到对象的实例。 在 Microsoft.Windows.SoftwareLogo.Tests.InstallOSVersionCheck.InstallOSVersionCheck.ExecuteTest()
    • 未修复时会产生影响: 这不必要地阻止客户安装其应用。
  • 如何修复: 通过测试当前版本是否高于或等于所需版本来测试是否存在正确 Windows 版本。 操作系统版本控制
Windows development | Windows App SDK
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-30T11:56:17.6266667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To fix the issue of failing the Windows App Certification Kit scan related to the operating system version check, you should ensure that your application is tested against the correct version of Windows. The error message indicates that a System.NullReferenceException occurred, which suggests that the test is trying to access an object that hasn't been properly initialized.

    Here are steps you can take to resolve this issue:

    1. Check Windows Version: Ensure that the version of Windows on which you are testing your application meets the minimum requirements specified for your app.
    2. Update Your Test Environment: Make sure that your testing environment is up to date with the latest Windows updates and that it matches the target version your app is designed for.
    3. Review Your Code: Look for any instances in your code where an object might not be initialized before it is used, particularly in the context of version checks.
    4. Test on Different Configurations: If possible, test your app on different configurations to see if the issue persists across all setups.
    5. Consult Documentation: Refer to the Windows App Certification Kit documentation for any specific requirements or known issues related to the version check tests.

    By ensuring that your application meets the necessary version requirements and addressing any potential coding issues, you should be able to pass the Windows App Certification Kit scan successfully.

    0 comments No comments

  2. Danny Nguyen (WICLOUD CORPORATION) 6,045 Reputation points Microsoft External Staff Moderator
    2025-12-31T06:10:12.5866667+00:00

    你好,

    此错误表示:在运行“操作系统版本检查”测试时,Windows 应用商店认证工具(WACK)内部发生了异常 (System.NullReferenceException),而不是你的应用本身在这里直接报错。

    可以尝试下面几步来修复:

    1. 不要用旧方式直接比较操作系统版本号
      • 尽量不要用 Environment.OSVersionGetVersionEx 等直接比较版本号的方法。
      • 建议:
        • 应用清单(manifest) 中声明最低支持的 Windows 版本,让系统或商店来检查。
        • 如果是 .NET 应用,可以使用:
          
                 if (OperatingSystem.IsWindowsVersionAtLeast(10, 0, 19041))
          
                 {
          
                     // 仅在 Windows 10 2004 及更高版本中运行的代码
          
                 }
          
          
        • 或使用 IsWindows10OrGreater() 等 Version Helper,并在 manifest 中正确配置 supportedOS
    2. 检查应用启动或安装时是否有空引用异常
      • 在全新、干净的 Windows 系统上安装并启动你的应用,再运行认证工具。
      • 确认应用启动、安装过程中的代码没有 NullReferenceException(检查注册表、文件、服务、COM 对象等访问前是否为 null)。
    3. 更新工具并收集日志
      • 确保使用的是最新版本的 Windows App Certification Kit。
      • 如果异常始终显示在 Microsoft.Windows.SoftwareLogo.Tests.InstallOSVersionCheck.InstallOSVersionCheck.ExecuteTest(), 而不是你的应用代码中,可以导出 WACK 日志(XML),然后联系微软支持,说明测试本身抛出了异常。

    希望这些信息对你有帮助。


Your answer

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