Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClientModel: Make message.Apply(options) take nullable options #43212

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/core/System.ClientModel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Removed `[Serializable]` attribute and serialization constructor from `ClientResultException`.
- Made `value` parameter nullable in `PipelineMessage.SetProperty` method.
- Made `options` parameter to `PipelineMessage.Apply` nullable.

### Bugs Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected internal PipelineMessage(System.ClientModel.Primitives.PipelineRequest
public System.ClientModel.Primitives.PipelineRequest Request { get { throw null; } }
public System.ClientModel.Primitives.PipelineResponse? Response { get { throw null; } protected internal set { } }
public System.ClientModel.Primitives.PipelineMessageClassifier ResponseClassifier { get { throw null; } set { } }
public void Apply(System.ClientModel.Primitives.RequestOptions options) { }
public void Apply(System.ClientModel.Primitives.RequestOptions? options) { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public System.ClientModel.Primitives.PipelineResponse? ExtractResponse() { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected internal PipelineMessage(System.ClientModel.Primitives.PipelineRequest
public System.ClientModel.Primitives.PipelineRequest Request { get { throw null; } }
public System.ClientModel.Primitives.PipelineResponse? Response { get { throw null; } protected internal set { } }
public System.ClientModel.Primitives.PipelineMessageClassifier ResponseClassifier { get { throw null; } set { } }
public void Apply(System.ClientModel.Primitives.RequestOptions options) { }
public void Apply(System.ClientModel.Primitives.RequestOptions? options) { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public System.ClientModel.Primitives.PipelineResponse? ExtractResponse() { throw null; }
Expand Down
9 changes: 4 additions & 5 deletions sdk/core/System.ClientModel/src/Message/PipelineMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,13 @@ public CancellationToken CancellationToken
/// complete, and prior to the call to
/// <see cref="ClientPipeline.Send(PipelineMessage)"/>.
/// </remarks>
public void Apply(RequestOptions options)
public void Apply(RequestOptions? options)
{
Argument.AssertNotNull(options, nameof(options));

// This design moves the client-author API (options.Apply) off the
// client-user type RequestOptions. Its only purpose is to call through to
// the internal options.Apply method.
options.Apply(this);
// the internal options.Apply method. If null options are passed this
// method is a no-op.
options?.Apply(this);
}

/// <summary>
Expand Down
Loading