autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Nullable client properties.

Open NiklasGustafsson opened this issue 10 years ago • 7 comments

I find it odd that these two standard client properties are nullable (which comes from not being required).

Since there are default values, per the doc comment, when would either one ever be null?

    /// <summary>
    /// Gets or sets the retry timeout in seconds for Long Running
    /// Operations. Default value is 30.
    /// </summary>
    int? LongRunningOperationRetryTimeout { get; set; }

    /// <summary>
    /// When set to true a unique x-ms-client-request-id value is
    /// generated and included in each request. Default is true.
    /// </summary>
    bool? GenerateClientRequestId { get; set; }

NiklasGustafsson avatar Mar 07 '16 19:03 NiklasGustafsson

@NiklasGustafsson is there ever a case where someone would deliberately set those to null?

It's nullable in IAzureClient in the client runtime. Not sure we can do much with this without risking a breaking change.

fearthecowboy avatar Sep 28 '16 19:09 fearthecowboy

I can't think of a reason why you would set it to null.

NiklasGustafsson avatar Sep 28 '16 20:09 NiklasGustafsson

Weird -- just found this: https://github.com/Azure/autorest/pull/91 anyone know why?

fearthecowboy avatar Sep 28 '16 22:09 fearthecowboy

Not sure why, but not all clients expose long-running operations, so the LongRunningRetryOperationTimeout property is not always relevant (see https://github.com/Azure/autorest/issues/1441). There are better ways than nullable to deal with that though.

bitsforthought avatar Sep 29 '16 21:09 bitsforthought

I agree -- even if it's not used a, reference to an int costs no less bytes than the int...

I'm gonna dig a bit more ...

fearthecowboy avatar Sep 29 '16 21:09 fearthecowboy

I never did find out why this was made to do this.

We've moved the C# ClientRuntime to the https://github.com/Azure/azure-sdk-for-net/ repository.

If this is still of concern, please file an issue in that project.

fearthecowboy avatar Nov 04 '16 18:11 fearthecowboy

@fearthecowboy This isn't a ClientRuntime issue as these properties are included in the generated ServiceClient-derived classes by AutoRest.

I'm fine with this issue being closed though, as I have another issue tracking this: https://github.com/Azure/autorest/issues/1441

bitsforthought avatar Nov 04 '16 19:11 bitsforthought