mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
CmdPal: Once again, I am asking you to fix form submits (#41010)
Closes #40979 Usually, you're supposed to try to cast the action to a specific type, and use those objects to get the data you need. However, there's something weird with AdaptiveCards and the way it works when we consume it when built in Release, with AOT (and trimming) enabled. Any sort of `action.As<IAdaptiveSubmitAction>()` or similar will throw a System.InvalidCastException. Instead we have this horror show. The `action.ToJson()` blob ACTUALLY CONTAINS THE `type` field, which we can use to determine what kind of action it is. Then we can parse the JSON manually based on the type.
This commit is contained in:
@@ -225,6 +225,11 @@ internal sealed partial class SampleContentForm : FormContent
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Action.OpenUrl",
|
||||
"title": "Action.OpenUrl",
|
||||
"url": "https://adaptivecards.microsoft.com/"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user