Skip to content

fixes netstandard2.0 bug in embeddings request response types#675

Merged
prathikr merged 2 commits intomainfrom
prathikrao/embeddings-netstandard2.0-bugfix
Apr 24, 2026
Merged

fixes netstandard2.0 bug in embeddings request response types#675
prathikr merged 2 commits intomainfrom
prathikrao/embeddings-netstandard2.0-bugfix

Conversation

@prathikr
Copy link
Copy Markdown
Contributor

E:\_work\1\s\sdk\cs\src\OpenAI\EmbeddingRequestResponseTypes.cs(60,16): error CS8604: 
  Possible null reference argument for parameter 'responseData' in 'EmbeddingCreateResponse EmbeddingRequestResponseExtensions.ToEmbeddingResponse(string responseData, ILogger logger)'. 
  [E:\_work\1\s\sdk\cs\src\Microsoft.AI.Foundry.Local.csproj::TargetFramework=netstandard2.0]

The null check string.IsNullOrWhiteSpace doesn't narrow the nullable type under netstandard2.0's annotations. Needs to be response.Data! to avoid error but we know it's not null or whitespace due to the check above.

Copilot AI review requested due to automatic review settings April 24, 2026 17:19
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment Apr 24, 2026 7:05pm

Request Review

@prathikr prathikr changed the title fixes fixes netstandard2.0 bug in embeddings request response types Apr 24, 2026
baijumeswani
baijumeswani previously approved these changes Apr 24, 2026
@prathikr prathikr enabled auto-merge (squash) April 24, 2026 17:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes a nullable flow-analysis warning under netstandard2.0 by ensuring response.Data is treated as non-null after an existing guard.

Changes:

  • Added a null-forgiving operator (!) when passing response.Data into ToEmbeddingResponse.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sdk/cs/src/OpenAI/EmbeddingRequestResponseTypes.cs
phanindraraja
phanindraraja previously approved these changes Apr 24, 2026
@prathikr prathikr merged commit 0579d42 into main Apr 24, 2026
47 checks passed
@prathikr prathikr deleted the prathikrao/embeddings-netstandard2.0-bugfix branch April 24, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants