Skip to content

Fix in-process decoding of DateTime in EventSource #67557

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

Merged

Conversation

josalem
Copy link
Contributor

@josalem josalem commented Apr 4, 2022

Fixes #61563

Will require backporting to release/6.0 since this is a regression from 5.0.

@MihaZupan root caused this issue succinctly in this comment: #61563 (comment)

@tommcdon it is a bug introduced by #52092 in .NET 6.0, but only affects in-process EventListeners.

The difference is in how the serialized value (long) is de-serialized by DecodeObjects:

Sadly this was not caught by tests since none of them uses DateTime with WriteEventCore - we are only testing the varargs overload.

The fix here would be to change


to

decoded = DateTime.FromFileTimeUtc(*(long*)dataPointer);

-- MihaZupan

@josalem josalem added this to the 7.0.0 milestone Apr 4, 2022
@josalem josalem requested a review from a team April 4, 2022 21:31
@josalem josalem self-assigned this Apr 4, 2022
@ghost
Copy link

ghost commented Apr 4, 2022

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #61563

Will require backporting to release/6.0 since this is a regression from 5.0.

@MihaZupan root caused this issue succinctly in this comment: #61563 (comment)

@tommcdon it is a bug introduced by #52092 in .NET 6.0, but only affects in-process EventListeners.

The difference is in how the serialized value (long) is de-serialized by DecodeObjects:

Sadly this was not caught by tests since none of them uses DateTime with WriteEventCore - we are only testing the varargs overload.

The fix here would be to change


to

decoded = DateTime.FromFileTimeUtc(*(long*)dataPointer);

-- MihaZupan

Author: josalem
Assignees: josalem
Labels:

area-System.Diagnostics.Tracing

Milestone: 7.0.0

Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danmoseley
Copy link
Member

Sadly this was not caught by tests

Is such a test feasible?

@josalem
Copy link
Contributor Author

josalem commented Apr 4, 2022

Sadly this was not caught by tests

Is such a test feasible?

Let me take a look and add one if so.

@josalem
Copy link
Contributor Author

josalem commented Apr 5, 2022

Test added! I'll merge on clean CI.

@josalem
Copy link
Contributor Author

josalem commented Apr 12, 2022

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@josalem
Copy link
Contributor Author

josalem commented Apr 13, 2022

The test failures are #67878.

The macOS NativeAOT job timed out, so I'll rerun it.

@josalem
Copy link
Contributor Author

josalem commented Apr 20, 2022

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@josalem
Copy link
Contributor Author

josalem commented Apr 21, 2022

Tests all seem to pass but the Build Analysis check fails with test failures that aren't shown elsewhere. Folks okay with merging anyway?

@noahfalk
Copy link
Member

I'd merge it : )

@josalem josalem merged commit d0916fb into dotnet:main Apr 21, 2022
@josalem josalem deleted the dev/josalem/eventsource-datetime-encoding branch April 21, 2022 21:57
@josalem
Copy link
Contributor Author

josalem commented Apr 21, 2022

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/2204546765

@ghost ghost locked as resolved and limited conversation to collaborators May 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WriteEventCore with DateTime has changed behavior in .Net 6.0
5 participants