Closed ordinaryorange closed 3 years ago
Hmm. Does Console.WriteLine(typeof(DateTime).Assembly)
work?
Yep works as expected. Console.WriteLine
just effectively calls the .ToString()
on the object. So it is not doing any deep property inspection like the Logger.
This is not a logger concern IMHO as this limitation comes from the WebAssembly support to serialize Assembly
type, which fails using the default JSON serializer. If you need to serialize by default unsupported objects, then use the override for the log method that's accepting a Func<TState, Exception, string> formatter
, so you can create message
that is being sent to the browser or the FormattedLogObject
instance as needed. In the next release the FormattedLogObject
type will be public for this reason.
Using Blazor Webassembly project. I have Logging configured and working for simple logging scenarios, but have discovered that the logging service will throw an exception when passed more complex objects.
For example this call
Logger.LogDebug(typeof(DateTime).Assembly)
throws this in the console
Looks to be an issue with the JSON serialization.