-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WPF][Rendering/Templating] Renderer throws newtonsoft error #3518
Comments
Thanks for reporting this @DeeJayTC ; The currently released version of the .NET renderer does not support the templating feature at this point in time. @paulcam206 / @matthidinger can you please correct me if i am wrong? Having said that that error seems very very obscure and something we may want to investigate and address as being more actionable and useful - @almedina-ms FYI (specially to track fixing the error here) |
Also @DeeJayTC just for our understanding, could you describe the scenario you are trying to use AdaptiveCards as well as the templating stack in? Thanks! |
Well, based on what @matthidinger said yesterday it is supported. Technically the templating just changes strings on the json itself, the render receives a final card where the templating is already done. We're trying to render a card in a Visual Studio Extension (eg WPF Control) |
Hmm so essentially you are just using the WPF renderer like you would to render a regular JSON file; Do you have the actual transformed JSON with the AdaptiveCard type element in there also ? I dont see that in the taskCardsampleData.txt file you provided nor the taskCard.txt which seems to be the pre-transformed json..In other words what is the JSON you are trying to pass in to the call to FromJson? |
Thanks for asking for that....found the issue. Only weird thing is that the designer on https://vnext.adaptivecards.io/designer/ renders it just fine while the WPF one throws that error. |
Good afternoon @DeeJayTC I'm currently trying to reproduce the error you were talking about, I'm using the WPF visualizer app removing the references to local projects and using the nuget packages you mentioned, I replaced the lines as you specified having this now var transformer = new AdaptiveTransformer();
var cardJson = transformer.Transform(CardPayload, templateData);
AdaptiveCard card2 = AdaptiveCard.FromJson(cardJson).Card; So far I haven't found the error and I tried to force the error by changing this line to force an error by changing root to rot "text": "by [{$rot['creator-firstname']} {$root['creator-lastname']}]({$root.rooturl}/people/{$root['creator-id']})", and it doesnt generate the error but I do get the undefined string in the generated view |
hmm maybe because $rot does not exist while $data does but has different properties to $root. |
Hi Sorry for the delay, I made a really simple test app for templating scenarios, it's located in this branch The project is under the source/dotnet/AdaptiveCards.sln solution and the project is called AdaptiveCards.Sample.WPFTemplating. It's a really simple visualizer with preloaded data and you just need to click on the "Render" button to render the card, I tried to reproduce the error with it but I wasn't able, if you can could you append the json files you managed to generate the error with? Thank you Alberto Medina |
This issue has been automatically marked as stale because it has not had any activity for 5 days. |
Tracked by #1984 |
Platform
What platform is your issue or question related to? (Delete other platforms).
Author or host
Host, trying to render a card in my own app (visual studio extension)
Version of SDK
AdaptiveCards.Rendering.Wpf -> 1.2.3
AdaptiveCards.Rendering.Wpf.Xceed -> 1.2.3
AdaptiveCards.Templating -> v0.1.0-alpha1
Details
When trying to use the designer (vnext version) its all fine, designer renders the card+template correctly. Things are not working only with WPF renderer.
Keep getting this exception:
System.InvalidOperationException: 'Current error context error is different to requested error.'
during a call to : AdaptiveCard.FromJson(cardJson).Card;
This is my code:
var transformer = new AdaptiveTransformer();
var cardJson = transformer.Transform(templateData, taskData);
AdaptiveCard card = AdaptiveCard.FromJson(cardJson).Card;
Find attached card template and the card data, data-binding works fine tho.
taskCardSampleData.txt
taskCard.txt
The text was updated successfully, but these errors were encountered: