-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Block Execution of GetType() in Evaluation #6769
Conversation
if (param != null) | ||
{ | ||
if (String.Equals(param.GetType().ToString(), param.ToString(), StringComparison.Ordinal)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed because the type of the object in my test was System.String
and in #DEBUG
it thought it was an invalid ToString()
call on a resource. That ended up throwing another invalid project exception which caused a stack overflow.
🤣 |
Stop allowing execution of GetType. This can lead to a lot of methods available that should not be called during evaluation.
10dc49c
to
be92f49
Compare
@jeffkl Thought you might appreciate this 😄
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good and I am in favor of the change. My only concern is that it's coming a bit late in the cycle for a breaking change. IIRC we discussed this and agreed on taking it now, is that right @marcpopMSFT?
I think we decided to take it as long as it made it in for preview 4 to give time for feedback given it was not particularly safe to do this. I don't think there's a good way of finding out if people are calling this already and how often. |
Can ya'll take a quick look through these queries to see if any critical areas are impacted (eg CBT): Looks like a handful of impacted customers but not many. |
Those links look fine. I did a spot check of |
// Check that the function that we're going to call is valid to call | ||
if (!IsInstanceMethodAvailable(_methodMethodName)) | ||
{ | ||
ProjectErrorUtilities.ThrowInvalidProject(elementLocation, "InvalidFunctionMethodUnavailable", _methodMethodName, _receiverType.FullName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we modify the message to mention that there's a way to enable all methods with Traits.Instance.EnableAllPropertyFunctions
? It would be less painful for customers this way.
Breaking change documentation for this is here: https://docs.microsoft.com/dotnet/core/compatibility/sdk/6.0/calling-gettype-property-functions |
Stop allowing execution of
GetType()
. This can lead to calling methods that really should not be called during evaluation.