RequestTelemetry.Url is sometimes `null` while the typing says is should not
Describe the bug
RequestTelemetry.Url is sometimes null, but the typing says it's a non-nullable Uri
https://github.com/microsoft/ApplicationInsights-dotnet/blob/c739fdd6a6ec6687911ccc3de8baff0d669af899/BASE/src/Microsoft.ApplicationInsights/DataContracts/RequestTelemetry.cs#L222
To Reproduce
See for example the first RequestTelemetry constructor, the Url property isn't set.
https://github.com/microsoft/ApplicationInsights-dotnet/blob/c739fdd6a6ec6687911ccc3de8baff0d669af899/BASE/src/Microsoft.ApplicationInsights/DataContracts/RequestTelemetry.cs#L39-L47
See also https://github.com/microsoft/ApplicationInsights-dotnet/issues/932
Needed change
- Mark the
Urlproperty as nullable, or never setnull. (e.g.\) - Or set
[System.Diagnostics.CodeAnalysis.MaybeNull]. See also https://github.com/microsoft/ApplicationInsights-dotnet/pull/2544/files
Same heere. We recently updated our codebase from Microsoft.ApplicationInsights 2.4 and are now getting URLs that are null. We previously had a TelemetryProcessor that converted the item into a RequestTelemetry and checked the Url without null checks and that is now blowing up.
The Application Insights .NET SDK is not compiled with "#nullable enable". Therefore, that Url property may be null by default. (System.Uri is a class)
Indeed, the doc-comments in the source say that the property is "optional".
This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.
A fix is still needed