Closed Crashdummyy closed 6 years ago
I suspect the item doesn't have a parent. Thus self.parent is null.
On Nov 24, 2017 13:08, "Simon" notifications@github.com wrote:
Hey There,
My Webhook responds everytime with ( Object reference not set to an instance of an object. (500) ) Exception.
How can that Exception be thrown?
` var userStory = self.Parent;
(double)userStory["Microsoft.VSTS.Scheduling.CompletedWork"] =
userStory.Children.Sum(task =>
task.GetField
`
The Code is very Simple and even provides an default Value.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tfsaggregator/tfsaggregator-webhooks/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AD-uSwSmBkmY9gjEBCTqh9PgihmuFiSpks5s5rG6gaJpZM4Qpvdu .
it does have a Parent. And the Code does what it should.
The only Problem is that it throws this Error.
I will try again with checking for parent
remove the (double)
cast
Don't know if that was the Problem ( will not find out :smile: ) I'm additionally checking the Parent for the Valid field ( if there is no Parent, there is no valid field of course ).
Code Seems to work fine now
The Double Cast was already removed before Casting has led me to false results, too.
It should be relatively easy to add a validation wrapper for getfield to log additional debug data when requesting a field that doesn't exist. Then log the work item type you're actually inspecting.
On Nov 24, 2017 1:24 PM, "Simon" notifications@github.com wrote:
Closed #11 https://github.com/tfsaggregator/tfsaggregator-webhooks/issues/11.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tfsaggregator/tfsaggregator-webhooks/issues/11#event-1357065396, or mute the thread https://github.com/notifications/unsubscribe-auth/AD-uS8AhVoWoCgVUJOdDpwNzSMQF5hWKks5s5rV2gaJpZM4Qpvdu .
You're Right should have done that already :/
Because that "Workaround" I did won't work for an additional Custom field.
TF26027: A field definition Microsoft.VSTS.Scheduling.StoryPoints in the work item type definition file does not exist. Add a definition for this field or remove the reference to the field and try again. (500)
Is the next Error so I need to add some getField Validators. Will do that on monday ;)
Hey There,
My Webhook responds everytime with ( Object reference not set to an instance of an object. (500) ) Exception.
How can that Exception be thrown?
` var userStory = self.Parent;
`
The Code is very Simple and even provides an default Value.