microsoft / microsoft/AdaptiveCards

[Rendering] WPF render load assembly fail in dotnet 6 framework

Open
#8,949 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Renderers Bug
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

Target Platforms

WPF

SDK Version

2.8.0

Application Name

Any

Problem Description

Calling adaptiveCardRenderer.RenderCard will throw an exception in dotnet 6:

System.IO.FileNotFoundException:“Could not load file or assembly 'AdaptiveCards.Rendering.Wpf, Culture=neutral, PublicKeyToken=null"

Why? Because AssemblyName of the dotnet 6 version is AdaptiveCards.Rendering.Wpf.Net6, see

https://github.com/microsoft/AdaptiveCards/blob/1243a36a19cb014a8fd638342d0d89657dc33f55/source/dotnet/Library/AdaptiveCards.Rendering.Wpf.Net6/AdaptiveCards.Rendering.Wpf.Net6.csproj#L7C19-L7C51

But the AdaptiveCardRenderer.cs will load the AdaptiveCards.Rendering.Wpf assembly and throw the exception, see

https://github.com/microsoft/AdaptiveCards/blob/1243a36a19cb014a8fd638342d0d89657dc33f55/source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveCardRenderer.cs#L97

Mini repro step:

  1. Create an empty .NET 6 wpf project.
  2. Install AdaptiveCards.Rendering.Wpf package
  3. Add the code in MainWindow.xaml.cs
        var adaptiveCardRenderer = new AdaptiveCardRenderer(new AdaptiveHostConfig()
        {
            
        });
        var adaptiveCard = new AdaptiveCard(new AdaptiveSchemaVersion(1,0));
        adaptiveCard.Body.Add(new AdaptiveTextBlock()
        {
            Text = "Hello",
            Size = AdaptiveTextSize.ExtraLarge
        });
        var json = adaptiveCard.ToJson();

        var result = adaptiveCardRenderer.RenderCard(adaptiveCard);

You can find my demo code in : https://github.com/lindexi/lindexi_gd/tree/e00981126d6c0d56aee41d9142e6b944d42b0a2a/WPFDemo/LaifearwheafoWhemhaldaycearai

Screenshots

No response

Card JSON
{}
Sample Code Language

C#

Sample Code

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with source/dotnet/Library/AdaptiveCards.Rendering.Wpf.Net6/AdaptiveCards.Rendering.Wpf.Net6.csproj and AdaptiveCardRenderer.cs around the assembly load noted in the issue. Reproduce the failure in an empty .NET 6 WPF project using the provided code, then verify that installing AdaptiveCards.Rendering.Wpf and calling RenderCard completes without the FileNotFoundException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.