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
When using the [LogProperties] on an object with nullable-typed properties (e.g. DateTime?), the nullable-typed properties are being forced to string before being added to the state.TagArray while their non-nullable type (DateTime) remains DateTime-typed in the TagArray.
Both myEvent.TimeStamp and myEvent.TimeStampNullable get added to the state.TagArray as DateTimes in the auto-generated logging code.
Actual behavior
In the autogenerated code, myEvent.TimeStamp field gets added to the TagArray as a DateTime (same type as it was in the event), but myEvent.TimeStampNullable is added to the TagArray as a string:
state.TagArray[2]=new("myEvent.TimeStamp",myEvent?.TimeStamp);state.TagArray[1]=new("myEvent.TimeStampNullable",myEvent?.TimeStampNullable?.ToString());// <--- LINE WITH BUG
Description
When using the
[LogProperties]
on an object with nullable-typed properties (e.g.DateTime?
), the nullable-typed properties are being forced tostring
before being added to thestate.TagArray
while their non-nullable type (DateTime
) remainsDateTime
-typed in theTagArray
.Reproduction Steps
Given the following user-written code:
and
csproj
:Expected behavior
Both
myEvent.TimeStamp
andmyEvent.TimeStampNullable
get added to thestate.TagArray
asDateTime
s in the auto-generated logging code.Actual behavior
In the autogenerated code,
myEvent.TimeStamp
field gets added to theTagArray
as aDateTime
(same type as it was in the event), butmyEvent.TimeStampNullable
is added to theTagArray
as astring
:Complete generated code:
Regression?
Unknown
Known Workarounds
No response
Configuration
It does not look specific to any architecture/.NET version.
Other information
No response
The text was updated successfully, but these errors were encountered: