You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What package version of the SDK are you using. 4.23.1
What nodejs version are you using 22
What browser version are you using -
What os are you using macOS
Describe the bug
When providing a non-standard object to $root in AC.expand() when rendering adaptive cards, the context cannot access properties that are in non-standard objects.
To Reproduce
AC.expand({ $root: new DataObjectOfYourChoice({ propertyToAccess: "hasAValue" }) })
AC template: "text": "${propertyToAccess}"
Expected behavior
Text should show "hasAValue", but the property is returned as undefined
Additional context
I tried opening a fix PR for this but i'm unsure of the contribution rules in this repo of if it is even possible. Pushing to a feature branch is not allowed for my git user.
The fix would be in libraries/adaptive-expressions/src/functionUtils.internal.ts lines 221-232:
const prop: string = Object.keys(instance).find(
(k: string): boolean => k.toLowerCase() === property.toLowerCase(),
);
if (prop !== undefined) {
value = instance[prop];
} else if (instance[property] !== undefined || instance[property.toLowerCase()] !== undefined) {
value = instance[property] ?? instance[property.toLowerCase()];
}
My change is the else block.
The text was updated successfully, but these errors were encountered:
LeonYasoon
added
bug
Indicates an unexpected problem or an unintended behavior.
needs-triage
The issue has just been created and it has not been reviewed by the team.
labels
Feb 25, 2025
Hi @LeonYasoon , we tried reproducing this issue but when we passed a correctly instantiated object to the context, the property was set as expected in the card.
On the other hand, we found a bug related to casing. In JavaScript, property names are case-sensitive. The accessProperty function uses toLowerCase to locate a property, which can produce unexpected results.
In these images you can see both scenarios. Is it possible that the object you are using has a similar condition?
@ceciliaavila Thanks for your thorough testing. In fact, in this minimal repro scenario it does work!
What we have is something similar to this:
Which does still work when testing with this minimal setup.
When opening this ticket i had a case where Object.keys would not return anything for DataObjects which had getters instead of actual class property values, thats why i suggested to fallback to looking in instance.property when Object.key didn't work.
But now i cant reproduce it anymore 🤷
Thanks for investigating and i hope your casing PR gets merged. Might have just been a plain casing issue after all.
If i manage to find the Object.keys issue again i will reopen this issue.
Versions
What package version of the SDK are you using. 4.23.1
What nodejs version are you using 22
What browser version are you using -
What os are you using macOS
Describe the bug
When providing a non-standard object to
$root
inAC.expand()
when rendering adaptive cards, the context cannot access properties that are in non-standard objects.To Reproduce
AC.expand({ $root: new DataObjectOfYourChoice({ propertyToAccess: "hasAValue" }) })
AC template:
"text": "${propertyToAccess}"
Expected behavior
Text should show "hasAValue", but the property is returned as undefined
Additional context
I tried opening a fix PR for this but i'm unsure of the contribution rules in this repo of if it is even possible. Pushing to a feature branch is not allowed for my git user.
The fix would be in
libraries/adaptive-expressions/src/functionUtils.internal.ts
lines 221-232:My change is the
else
block.The text was updated successfully, but these errors were encountered: