It is possible to send an OTEL log entry without a body. For example, a customer at https://github.com/dotnet/aspire/issues/6703 configured OpenAPI instrumentation to not send a body. This caused an error in Aspire and the telemetry wasn't loaded.
Aspire assumes there is always a body and errors when attempting to access it and convert to the log entry message. The log entry won't be visible in Aspire.
The fix is to set the message to an empty string when there is no body present.
Note: One customer has raised this issue but it could be more widespead. Aspire doesn't give a notification that telemetry failed to load, it just won't be present in the UI.
Testing
Unit test.
Manual testing by creating OTLP log entry manually without body:
Backport of #6725 to release/9.0
/cc @JamesNK
Customer Impact
It is possible to send an OTEL log entry without a body. For example, a customer at https://github.com/dotnet/aspire/issues/6703 configured OpenAPI instrumentation to not send a body. This caused an error in Aspire and the telemetry wasn't loaded.
Aspire assumes there is always a body and errors when attempting to access it and convert to the log entry message. The log entry won't be visible in Aspire.
The fix is to set the message to an empty string when there is no body present.
Note: One customer has raised this issue but it could be more widespead. Aspire doesn't give a notification that telemetry failed to load, it just won't be present in the UI.
Testing
Unit test.
Manual testing by creating OTLP log entry manually without body:
Risk
Low
Regression?
No
Microsoft Reviewers: Open in CodeFlow