Skip to content

[Bug] ZXing.Windows.Compatibility PresentationCore not found #612

@moonheart

Description

@moonheart

We have a common method to scan types for automatic DI, but when scanning ZXing.Windows.Compatibility, it causes an Exception

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'PresentationCore, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 
File name: 'PresentationCore, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at System.Reflection.RuntimeAssembly.GetExportedTypes()


To reproduce:

csproj:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net9.0-windows</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
        <LangVersion>12</LangVersion>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="ZXing.Net" Version="0.16.10" />
      <PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.13" />
    </ItemGroup>

</Project>

code

public class Program
{
    public static void Main(string[] args)
    {
        var assemblyExportedTypes1 = typeof(ZXing.Windows.Compatibility.BarcodeReader).Assembly.ExportedTypes;
        Console.WriteLine(assemblyExportedTypes1);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions