Skip to content

Merge main into live#52090

Open
dotnet-policy-service[bot] wants to merge 6 commits intolivefrom
main
Open

Merge main into live#52090
dotnet-policy-service[bot] wants to merge 6 commits intolivefrom
main

Conversation

@dotnet-policy-service
Copy link
Contributor

@dotnet-policy-service dotnet-policy-service bot commented Mar 5, 2026

Please don't squash-merge this PR.


Internal previews

Toggle expand/collapse
📄 File 🔗 Preview link
docs/ai/quickstarts/ai-templates.md Create a .NET AI app to chat with custom data using the AI app template extensions
docs/ai/quickstarts/build-chat-app.md Quickstart - Build an AI chat app with .NET
docs/ai/quickstarts/build-mcp-client.md Create a minimal MCP client using .NET
docs/ai/quickstarts/build-mcp-server.md Create a minimal MCP server using C# and publish to NuGet
docs/ai/quickstarts/build-vector-search-app.md docs/ai/quickstarts/build-vector-search-app
docs/ai/quickstarts/chat-local-model.md Chat with a local AI model using .NET
docs/ai/quickstarts/create-assistant.md Quickstart - Create a minimal AI assistant using .NET
docs/ai/quickstarts/generate-images.md Generate images using OpenAI.Images.ImageClient
docs/ai/quickstarts/prompt-model.md docs/ai/quickstarts/prompt-model
docs/ai/quickstarts/publish-mcp-registry.md Publish an MCP server on NuGet.org to the Official MCP Registry
docs/ai/quickstarts/structured-output.md Quickstart - Request a response with structured output
docs/ai/quickstarts/text-to-image.md Generate images from text using AI
docs/ai/quickstarts/use-function-calling.md Invoke .NET functions using an AI model
docs/csharp/language-reference/compiler-messages/lambda-expression-errors.md Errors and warnings when using lambda expressions and anonymous functions
docs/csharp/language-reference/toc.yml docs/csharp/language-reference/toc
docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md Coming in C# 15
docs/standard/native-interop/best-practices.md Native interoperability best practices - .NET
docs/standard/native-interop/calling-conventions.md Unmanaged calling conventions
docs/standard/native-interop/type-marshalling.md docs/standard/native-interop/type-marshalling

Copilot AI and others added 4 commits March 4, 2026 15:15
…oting (#51987)

* Add warnings about C long and wchar_t cross-platform type differences

The type marshalling table maps C# long to int64_t but does not warn that
C long is 32-bit on Windows and 64-bit on 64-bit Unix. Add an Important
note cross-referencing the CLong guidance in best-practices.md.

Also add a note about wchar_t being UTF-32 on non-Windows platforms,
which affects string marshalling decisions for cross-platform P/Invoke.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix ftw samples to use Utf8 instead of Utf16

The C ftw() function takes char* parameters (UTF-8 on Linux/macOS),
not wchar_t*. Using StringMarshalling.Utf16 is incorrect and would
cause the strings to be marshalled in the wrong encoding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add guidance on when calling conventions can be omitted

Calling conventions only need to be specified on Windows x86, where
Stdcall and Cdecl differ. On x64, ARM, and ARM64 there is only one
calling convention, making the attribute unnecessary. Add explicit
DO/DON'T recommendations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add troubleshooting table, GC.KeepAlive guidance, and header trust note

Add three new sections to the native interop best practices:

1. Troubleshooting P/Invoke failures: a symptom-to-cause-to-fix table
   covering DllNotFoundException, EntryPointNotFoundException,
   AccessViolationException, silent corruption, intermittent crashes,
   and heap corruption.

2. Preventing delegate collection with GC.KeepAlive: explains that
   GetFunctionPointerForDelegate does not root the source delegate,
   with a code example showing proper GC.KeepAlive usage.

3. Resolving conflicts between documentation and native headers:
   advises developers to treat native headers as the authoritative
   source for P/Invoke signatures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update docs/standard/native-interop/type-marshalling.md

Co-authored-by: Aaron R Robinson <arobins@microsoft.com>

* Update docs/standard/native-interop/best-practices.md

Co-authored-by: Aaron R Robinson <arobins@microsoft.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Aaron R Robinson <arobins@microsoft.com>
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@dotnetrepoman dotnetrepoman bot added this to the March 2026 milestone Mar 5, 2026
azure-sdk and others added 2 commits March 5, 2026 14:25
* Add stubs for the new errors

* Additional consolidation

Copilot found several new opportunities for consolication

* Additional missing error codes.

* Add new errors in appropriate sections.

* Focus on resolution, not cause

Rewrite the sections to focus on hose to fix errors, rather than the cause of the errors,

* Final edit pass

* Fix build warnings

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* insert xref

* remove duplicate key

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants