Skip to content

Fix NullReferenceException when evaluating `RunStepDetailsUpdate.FunctionName #50382

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public IReadOnlyList<RunStepDeltaCodeInterpreterOutput> CodeInterpreterOutputs
=> _asCodeCall?.CodeInterpreter?.Outputs;

/// <inheritdoc cref="RunStepDeltaFunction.Name"/>
public string FunctionName => _asFunctionCall.Function?.Name;
public string FunctionName => _asFunctionCall?.Function?.Name;
Copy link
Preview

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FunctionName property now returns null when _asFunctionCall is null, but its return type is declared as non-nullable string. Consider changing the return type to string? to accurately reflect nullability or provide a default value with the null-coalescing operator (e.g., ?? string.Empty).

Copilot uses AI. Check for mistakes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true for all properties in this class (see FunctionArguments). Project is not setting <Nullable>true</Nullable>. Best to match the current convention.


/// <inheritdoc cref="RunStepDeltaFunction.Arguments"/>
public string FunctionArguments => _asFunctionCall?.Function?.Arguments;
Expand Down