Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.25k stars 4.59k forks source link

[BUG] RequestUriBuilder is not escaping `:` when executing on net461 #35828

Open ArcturusZhang opened 1 year ago

ArcturusZhang commented 1 year ago

Library name and version

Azure.Core

Describe the bug

When I am using the following code:

var uri = new RequestUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("something");
uri.AppendQuery("datetime", "2022-12-19T11:12:12.0000000Z", true);

and when it is running on net461 target, we will get this uri as a result:

http://localhost/something?datetime=2022-12-19T11:12:12.0000000Z

and when the same code running on net6, we will get the following:

http://localhost/something?datetime=2022-12-19T11%3A12%3A12.0000000Z

Test results could be check here on the failure of AppendQuery_DateTimeOffsetValue

Expected behavior

We should get the same uri for net6 and net461 with the : escaped.

Actual behavior

The character : is not escaped.

Reproduction Steps

Reproduction code included in the description above.

Environment

No response

jsquire commented 1 year ago

@annelo-msft: Would you please triage and cost this?

annelo-msft commented 1 year ago

Thanks for filing this, @ArcturusZhang!

Can you help us understand -- is this something you discovered in tests, or is it a known issue with an existing SDK?

ArcturusZhang commented 1 year ago

Thanks for filing this, @ArcturusZhang!

Can you help us understand -- is this something you discovered in tests, or is it a known issue with an existing SDK?

It is something I discovered in tests. The tests are here: https://github.com/Azure/autorest.csharp/pull/3317