Skip to content
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

Removed null check as it can break the JsonWriter flow. #320

Closed
wants to merge 1 commit into from

Conversation

hallatore
Copy link
Contributor

We should't remove properties that are null as it might brake the flow of the JsonWriter.

PS: Why was this done in the first place? What could break on the back end with this change?

Ref #319

@msftclas
Copy link

msftclas commented Oct 1, 2016

Hi @hallatore, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@hallatore hallatore changed the title Removed null check as it can break the writer flow. Removed null check as it can break the JsonWriter flow. Oct 1, 2016
@abaranch
Copy link
Contributor

abaranch commented Oct 3, 2016

Thank you for your contribution. I will check whether we can fix it on the serializer side before accepting the contribution. I think the initial idea was to not send null values since that unnecessarily increases package size. (Also I'm pretty sure some unit tests would fail.)

@hallatore
Copy link
Contributor Author

I get why the code is there, but feel it might be at the wrong place. Right now it looks like a hack since it's placed in the middle of it all.

And it's also not included on this almost identical method. https://github.com/microsoft/ApplicationInsights-dotnet/blob/develop/src/Core/Managed/Shared/Extensibility/Implementation/JsonWriter.cs#L108-L121

@abaranch
Copy link
Contributor

abaranch commented Oct 3, 2016

Sorry, I got pulled away by a different task today.
Do you have a proposal how to fix it but still keep removing null values?..

@hallatore
Copy link
Contributor Author

I would normally say that it makes little sense to trim out the null's if it isn't a big issue. So how does the compressed payload look without this code? How much are we adding?

Easiest way to patch this (if it's a problem) is probably at the .Count > 0 step at https://github.com/microsoft/ApplicationInsights-dotnet/blob/develop/src/Core/Managed/Shared/Extensibility/Implementation/JsonWriter.cs#L110

@abaranch
Copy link
Contributor

abaranch commented Oct 4, 2016

I do not have numbers right away but since you are saying that fixing it with keeping existing behavior has the same complexity, let's keep the behavior.

@abaranch
Copy link
Contributor

abaranch commented Oct 5, 2016

I created a pull request that includes both

  • to keep existing functionality, change sanitization rules
  • your fix in case if in the future we decide that we want to start sending nulls
    Thank you for finding the issue and help with resolving it,.

@abaranch abaranch closed this Oct 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants