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
There is an issue with the use of atomic operations in the last version of the library.
The problem is that when we increase the log level to Trace level, the requests begins to fail because it's trying to serialize properties of 'System.Type' type.
We detect that the fail is produced inside the function LogMethodStart located at TraceLogWriter class that's called at the beginning of the implemented method inside, and these are the details of the exception:
Message: Serialization and deserialization of 'System.Type' instances are not supported. Path: $.TargetedFields.Attributes.Property.PropertyType.
StackTrace:
at System.Text.Json.ThrowHelper.ThrowNotSupportedException(WriteStack& state, NotSupportedException ex)
at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.WriteCoreAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.JsonSerializer.WriteUsingSerializer[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.WriteStringUsingSerializer[TValue](TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options)
at JsonApiDotNetCore.Middleware.TraceLogWriter`1.SerializeObject(Object value) in C:\Users\rodriguezalberto\repos\JsonApiDotNetCore\src\JsonApiDotNetCore\Middleware\TraceLogWriter.cs:line 140
at JsonApiDotNetCore.Middleware.TraceLogWriter`1.WriteObject(StringBuilder builder, Object value) in C:\Users\rodriguezalberto\repos\JsonApiDotNetCore\src\JsonApiDotNetCore\Middleware\TraceLogWriter.cs:line 116
at JsonApiDotNetCore.Middleware.TraceLogWriter`1.WriteProperty(StringBuilder builder, PropertyInfo property, Object instance) in C:\Users\rodriguezalberto\repos\JsonApiDotNetCore\src\JsonApiDotNetCore\Middleware\TraceLogWriter.cs:line 104
at JsonApiDotNetCore.Middleware.TraceLogWriter`1.WriteProperties(StringBuilder builder, Object propertyContainer) in C:\Users\rodriguezalberto\repos\JsonApiDotNetCore\src\JsonApiDotNetCore\Middleware\TraceLogWriter.cs:line 80
at JsonApiDotNetCore.Middleware.TraceLogWriter`1.FormatMessage(String memberName, Object parameters) in C:\Users\rodriguezalberto\repos\JsonApiDotNetCore\src\JsonApiDotNetCore\Middleware\TraceLogWriter.cs:line 57
at JsonApiDotNetCore.Middleware.TraceLogWriter`1.LogMethodStart(Object parameters, String memberName) in C:\Users\rodriguezalberto\repos\JsonApiDotNetCore\src\JsonApiDotNetCore\Middleware\TraceLogWriter.cs:line 36
at JsonApiDotNetCore.Controllers.BaseJsonApiOperationsController.<PostOperationsAsync>d__7.MoveNext() in C:\Users\rodriguezalberto\repos\JsonApiDotNetCore\src\JsonApiDotNetCore\Controllers\BaseJsonApiOperationsController.cs:line 107
STEPS TO REPRODUCE
Create an new project with the last version of JsonApiDotNetCore library
Add a resource and a controller inheriting the base class BaseJsonApiOperationsController
Implement the PostOperationsAsync method and call to the base method.
DESCRIPTION
There is an issue with the use of atomic operations in the last version of the library.
The problem is that when we increase the log level to
Trace
level, the requests begins to fail because it's trying to serialize properties of 'System.Type' type.We detect that the fail is produced inside the function
LogMethodStart
located atTraceLogWriter
class that's called at the beginning of the implemented method inside, and these are the details of the exception:Message:
Serialization and deserialization of 'System.Type' instances are not supported. Path: $.TargetedFields.Attributes.Property.PropertyType.
StackTrace:
STEPS TO REPRODUCE
BaseJsonApiOperationsController
PostOperationsAsync
method and call to the base method.Sample project:
https://github.com/arcarrillo/jsonapidotnetcore-trace
Sample call to this project (local execution):
Response:
EXPECTED BEHAVIOR
The request should be logged
ACTUAL BEHAVIOR
Returns a server error.
VERSIONS USED
The text was updated successfully, but these errors were encountered: