diff --git a/.github/prompts/error-consolidation.md b/.github/prompts/error-consolidation.md new file mode 100644 index 0000000000000..1705f493ff0ee --- /dev/null +++ b/.github/prompts/error-consolidation.md @@ -0,0 +1,23 @@ +# Copilot prompts to consolidate error codes. + +## Add a single existing file into the new consolidated article. + +Add the contents of cs1027.md to the preprocessor-errors.md file, sort that file by 'source_path_from_root'. Add a redirection for cs1027.md to point to preprocessor-errors.md, add "cs1027: to the list of display names in the TOC for preprocessor-errors.md. Finally, delete cs1027.md + +## Search for other related articles that may be missed. + +Search all files in the docs/csharp/language-reference/compiler-messages and the docs/csharp/misc folder for any other errors and warnings that involve preprocessor tokens. Give me a list to review for possible additional consolidation. + +## Final search in roslyn source + +To make sure you've found all related errors, we'll check the source. Look in `CSharpResources.resx` for any elements where the `` element is a message related to preprocessor tokens. The symbolic constant for that value is in the `name` attribute on the parent `data` element. Find that value in `ErrorCodes.cs`. It will map to the compiler error code, where the code is "CS" followed by the number as a four digit number. Build a list of any not already added to preprocessor-errors.md + +## Build consolidated sections + +Examine the highlighted section. Other H2s with similar themes should be combined in a similar format. The recommendations to fix the errors should point to language reference articles that explain the impacted syntax. + +To do that, make a new H2 section for the theme. Remove all the H2s for the individual error codes that are part of that theme. Where applicable, the new H2 can include text or examples from the H2s you remove. + +The list of errors at the top of the file should remain in numerical order, so it's easy for readers to scan. Each impacted error code should now have a link to the anchor tag for the new section. Repeat the list in the new section, but without the anchors, as shown in the highlighted text. + +Start with CS1024 and other errors that indicate "Not a valid preprocessor directive" \ No newline at end of file diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 2c69174844ccf..a5679d50008b5 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -71,6 +71,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5 + uses: github/codeql-action/upload-sarif@e296a935590eb16afc0c0108289f68c87e2a89a5 # v3.29.5 with: sarif_file: results.sarif diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index a01d6794de7f7..4917302845e7b 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -20,7 +20,7 @@ jobs: with: egress-policy: audit - - uses: actions/stale@3a9db7e6a41a89f618792c92c0e97cc736e1b13f + - uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 with: start-date: '2022-03-01T00:00:00Z' # ISO 8601 or RFC 2822 repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.openpublishing.redirection.csharp.json b/.openpublishing.redirection.csharp.json index b98367dfd9bed..976f2961e1071 100644 --- a/.openpublishing.redirection.csharp.json +++ b/.openpublishing.redirection.csharp.json @@ -363,6 +363,10 @@ "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1683.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references" }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1691.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, { "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0270.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors" @@ -1834,6 +1838,70 @@ "source_path_from_root": "/docs/csharp/misc/cs1020.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution" }, + { + "source_path_from_root": "/docs/csharp/misc/cs1024.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1025.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1027.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1028.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1029.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1030.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1032.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1038.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1040.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1517.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1560.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1576.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1578.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1633.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1634.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1635.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, { "source_path_from_root": "/docs/csharp/misc/cs1100.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations" @@ -1994,10 +2062,30 @@ "source_path_from_root": "/docs/csharp/misc/cs1686.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#syntax-limitations-in-lambda-expressions" }, + { + "source_path_from_root": "/docs/csharp/misc/cs1692.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1694.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1695.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/cs1696.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, { "source_path_from_root": "/docs/csharp/misc/cs1706.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#syntax-limitations-in-lambda-expressions" }, + { + "source_path_from_root": "/docs/csharp/misc/cs1709.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors" + }, { "source_path_from_root": "/docs/csharp/misc/cs1714.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references" diff --git a/docs/ai/evaluation/snippets/evaluate-safety/EvaluateResponseSafety.csproj b/docs/ai/evaluation/snippets/evaluate-safety/EvaluateResponseSafety.csproj index 2ffa6b3c5ab4a..41818a7509005 100644 --- a/docs/ai/evaluation/snippets/evaluate-safety/EvaluateResponseSafety.csproj +++ b/docs/ai/evaluation/snippets/evaluate-safety/EvaluateResponseSafety.csproj @@ -10,16 +10,16 @@ - - + + - - + + diff --git a/docs/ai/quickstarts/snippets/mcp-client/MinimalMCPClient.csproj b/docs/ai/quickstarts/snippets/mcp-client/MinimalMCPClient.csproj index 544573a165ff9..c3ed37a8510d1 100644 --- a/docs/ai/quickstarts/snippets/mcp-client/MinimalMCPClient.csproj +++ b/docs/ai/quickstarts/snippets/mcp-client/MinimalMCPClient.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/docs/ai/quickstarts/snippets/prompt-completion/openai/ExtensionsOpenAI.csproj b/docs/ai/quickstarts/snippets/prompt-completion/openai/ExtensionsOpenAI.csproj index 4c73b94f779ca..48f6fd9b6df56 100644 --- a/docs/ai/quickstarts/snippets/prompt-completion/openai/ExtensionsOpenAI.csproj +++ b/docs/ai/quickstarts/snippets/prompt-completion/openai/ExtensionsOpenAI.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.ConsumeRateLimitingEmbedding/ConsoleAI.ConsumeRateLimitingEmbedding.csproj b/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.ConsumeRateLimitingEmbedding/ConsoleAI.ConsumeRateLimitingEmbedding.csproj index 8fe4ec8365d16..1cd171969cdc6 100644 --- a/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.ConsumeRateLimitingEmbedding/ConsoleAI.ConsumeRateLimitingEmbedding.csproj +++ b/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.ConsumeRateLimitingEmbedding/ConsoleAI.ConsumeRateLimitingEmbedding.csproj @@ -8,7 +8,7 @@ - + diff --git a/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.CustomEmbeddingsMiddle/ConsoleAI.CustomEmbeddingsMiddle.csproj b/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.CustomEmbeddingsMiddle/ConsoleAI.CustomEmbeddingsMiddle.csproj index 6308d2eed104a..839d3952b6b3d 100644 --- a/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.CustomEmbeddingsMiddle/ConsoleAI.CustomEmbeddingsMiddle.csproj +++ b/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.CustomEmbeddingsMiddle/ConsoleAI.CustomEmbeddingsMiddle.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.FunctionalityPipelines/ConsoleAI.FunctionalityPipelines.csproj b/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.FunctionalityPipelines/ConsoleAI.FunctionalityPipelines.csproj index edcdee672eb5c..f3cfd2077e775 100644 --- a/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.FunctionalityPipelines/ConsoleAI.FunctionalityPipelines.csproj +++ b/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.FunctionalityPipelines/ConsoleAI.FunctionalityPipelines.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI/ConsoleAI.csproj b/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI/ConsoleAI.csproj index 851b8677ae3df..bc7fcde51ef94 100644 --- a/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI/ConsoleAI.csproj +++ b/docs/ai/snippets/microsoft-extensions-ai/ConsoleAI/ConsoleAI.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 5194ddd335170..66275336152d1 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -15,7 +15,7 @@ | Communication Call Automation | NuGet [1.5.0](https://www.nuget.org/packages/Azure.Communication.CallAutomation/1.5.0)
NuGet [1.6.0-beta.1](https://www.nuget.org/packages/Azure.Communication.CallAutomation/1.6.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.CallAutomation-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.CallAutomation_1.5.0/sdk/communication/Azure.Communication.CallAutomation/)
GitHub [1.6.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.CallAutomation_1.6.0-beta.1/sdk/communication/Azure.Communication.CallAutomation/) | | Communication Chat | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Communication.Chat/1.4.0) | [docs](/dotnet/api/overview/azure/Communication.Chat-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Chat_1.4.0/sdk/communication/Azure.Communication.Chat/) | | Communication Common | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Communication.Common/1.4.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Common/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.Common-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_1.4.0/sdk/communication/Azure.Communication.Common/)
GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_2.0.0-beta.1/sdk/communication/Azure.Communication.Common/) | -| Communication Email | NuGet [1.0.2](https://www.nuget.org/packages/Azure.Communication.Email/1.0.2)
NuGet [1.1.0-beta.2](https://www.nuget.org/packages/Azure.Communication.Email/1.1.0-beta.2) | [docs](/dotnet/api/overview/azure/Communication.Email-readme) | GitHub [1.0.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.0.2/sdk/communication/Azure.Communication.Email/)
GitHub [1.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.1.0-beta.2/sdk/communication/Azure.Communication.Email/) | +| Communication Email | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Communication.Email/1.1.0) | [docs](/dotnet/api/overview/azure/Communication.Email-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.1.0/sdk/communication/Azure.Communication.Email/) | | Communication Identity | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Communication.Identity/1.3.1)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Identity/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.Identity-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Identity_1.3.1/sdk/communication/Azure.Communication.Identity/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Identity_1.4.0-beta.1/sdk/communication/Azure.Communication.Identity/) | | Communication JobRouter | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Communication.JobRouter/1.0.0)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Communication.JobRouter/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.JobRouter-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.JobRouter_1.0.0/sdk/communication/Azure.Communication.JobRouter/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.JobRouter_1.1.0-beta.1/sdk/communication/Azure.Communication.JobRouter/) | | Communication Messages | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Communication.Messages/1.1.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Communication.Messages/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Communication.Messages-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Messages_1.1.0/sdk/communication/Azure.Communication.Messages/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Messages_1.3.0-beta.2/sdk/communication/Azure.Communication.Messages/) | @@ -53,7 +53,7 @@ | Health Insights Cancer Profiling | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Health.Insights.CancerProfiling/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Health.Insights.CancerProfiling-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.CancerProfiling_1.0.0-beta.1/sdk/healthinsights/Azure.Health.Insights.CancerProfiling/) | | Health Insights Clinical Matching | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Health.Insights.ClinicalMatching/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Health.Insights.ClinicalMatching-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.ClinicalMatching_1.0.0-beta.1/sdk/healthinsights/Azure.Health.Insights.ClinicalMatching/) | | Health Insights Radiology Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Health.Insights.RadiologyInsights/1.1.0) | [docs](/dotnet/api/overview/azure/Health.Insights.RadiologyInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.RadiologyInsights_1.1.0/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/) | -| Identity | NuGet [1.16.0](https://www.nuget.org/packages/Azure.Identity/1.16.0) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.16.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.16.0/sdk/identity/Azure.Identity/) | +| Identity | NuGet [1.17.0](https://www.nuget.org/packages/Azure.Identity/1.17.0) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.17.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.17.0/sdk/identity/Azure.Identity/) | | Identity Broker | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Identity.Broker/1.3.0) | [docs](/dotnet/api/overview/azure/Identity.Broker-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.3.0/sdk/identity/Azure.Identity.Broker/) | | Image Analysis | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Vision.ImageAnalysis/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Vision.ImageAnalysis-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Vision.ImageAnalysis_1.0.0/sdk/vision/Azure.AI.Vision.ImageAnalysis/) | | Key Vault - Administration | NuGet [4.6.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.6.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme) | GitHub [4.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.6.0/sdk/keyvault/Azure.Security.KeyVault.Administration/) | @@ -77,7 +77,7 @@ | Monitor Ingestion | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Monitor.Ingestion/1.2.0) | [docs](/dotnet/api/overview/azure/Monitor.Ingestion-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Ingestion_1.2.0/sdk/monitor/Azure.Monitor.Ingestion/) | | Monitor Query | NuGet [1.7.1](https://www.nuget.org/packages/Azure.Monitor.Query/1.7.1) | [docs](/dotnet/api/overview/azure/Monitor.Query-readme) | GitHub [1.7.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.7.1/sdk/monitor/Azure.Monitor.Query/) | | OpenAI Assistants | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.AI.OpenAI.Assistants/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.OpenAI.Assistants-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI.Assistants_1.0.0-beta.4/sdk/openai/Azure.AI.OpenAI.Assistants/) | -| OpenAI Inference | NuGet [2.1.0](https://www.nuget.org/packages/Azure.AI.OpenAI/2.1.0)
NuGet [2.3.0-beta.2](https://www.nuget.org/packages/Azure.AI.OpenAI/2.3.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme) | GitHub [2.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.1.0/sdk/openai/Azure.AI.OpenAI/)
GitHub [2.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.3.0-beta.2/sdk/openai/Azure.AI.OpenAI/) | +| OpenAI Inference | NuGet [2.1.0](https://www.nuget.org/packages/Azure.AI.OpenAI/2.1.0)
NuGet [2.5.0-beta.1](https://www.nuget.org/packages/Azure.AI.OpenAI/2.5.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme) | GitHub [2.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.1.0/sdk/openai/Azure.AI.OpenAI/)
GitHub [2.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.5.0-beta.1/sdk/openai/Azure.AI.OpenAI/) | | OpenTelemetry AspNetCore | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.AspNetCore/1.3.0) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.AspNetCore-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.AspNetCore_1.3.0/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/) | | OpenTelemetry Exporter | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.4.0) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.Exporter-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.4.0/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/) | | Personalizer | NuGet [2.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Personalizer/2.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Personalizer-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [2.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Personalizer_2.0.0-beta.2/sdk/personalizer/Azure.AI.Personalizer/) | @@ -395,7 +395,7 @@ | App Configuration Extension | NuGet [8.4.0](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.Functions.Worker/8.4.0) | | | | App Configuration Provider | NuGet [8.4.0](https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.AspNetCore/8.4.0) | | | | Azure.Communication.Administration | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Communication.Administration/1.0.0-beta.3) | | | -| Communication Calling Windows Client | NuGet [1.12.0](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.12.0)
NuGet [1.13.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.13.0-beta.1) | | | +| Communication Calling Windows Client | NuGet [1.12.0](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.12.0)
NuGet [1.13.0-beta.2](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.13.0-beta.2) | | | | Content Safety Extension Embedded Image | NuGet [1.0.1-beta.4](https://www.nuget.org/packages/Azure.AI.ContentSafety.Extension.Embedded.Image/1.0.1-beta.4) | | | | Content Safety Extension Embedded Text | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.ContentSafety.Extension.Embedded.Text/1.0.0)
NuGet [1.0.1-beta.4](https://www.nuget.org/packages/Azure.AI.ContentSafety.Extension.Embedded.Text/1.0.1-beta.4) | | | | Cosmos DB Fault Injection | NuGet [1.0.0-beta.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.FaultInjection/1.0.0-beta.0) | | | @@ -419,13 +419,13 @@ | Speech Extension Telemetry | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Telemetry/1.46.0) | | | | System Net Client Model | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/System.Net.ClientModel/1.0.0-beta.1) | | | | Unknown Display Name | NuGet [0.13.0-preview](https://www.nuget.org/packages/Azure.Iot.Operations.Connector/0.13.0-preview) | | | -| Unknown Display Name | NuGet [0.8.4](https://www.nuget.org/packages/Azure.Mcp/0.8.4) | | | -| Unknown Display Name | NuGet [0.8.4](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/0.8.4) | | | -| Unknown Display Name | NuGet [0.8.4](https://www.nuget.org/packages/Azure.Mcp.linux-x64/0.8.4) | | | -| Unknown Display Name | NuGet [0.8.4](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/0.8.4) | | | -| Unknown Display Name | NuGet [0.8.4](https://www.nuget.org/packages/Azure.Mcp.osx-x64/0.8.4) | | | -| Unknown Display Name | NuGet [0.8.4](https://www.nuget.org/packages/Azure.Mcp.win-arm64/0.8.4) | | | -| Unknown Display Name | NuGet [0.8.4](https://www.nuget.org/packages/Azure.Mcp.win-x64/0.8.4) | | | +| Unknown Display Name | NuGet [0.8.5](https://www.nuget.org/packages/Azure.Mcp/0.8.5) | | | +| Unknown Display Name | NuGet [0.8.5](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/0.8.5) | | | +| Unknown Display Name | NuGet [0.8.5](https://www.nuget.org/packages/Azure.Mcp.linux-x64/0.8.5) | | | +| Unknown Display Name | NuGet [0.8.5](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/0.8.5) | | | +| Unknown Display Name | NuGet [0.8.5](https://www.nuget.org/packages/Azure.Mcp.osx-x64/0.8.5) | | | +| Unknown Display Name | NuGet [0.8.5](https://www.nuget.org/packages/Azure.Mcp.win-arm64/0.8.5) | | | +| Unknown Display Name | NuGet [0.8.5](https://www.nuget.org/packages/Azure.Mcp.win-x64/0.8.5) | | | | Unknown Display Name | NuGet [0.1.4-preview.2](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Aot/0.1.4-preview.2) | | | | Unknown Display Name | NuGet [0.2.802](https://www.nuget.org/packages/Microsoft.Azure.Mcp.AzTypes.Internal.Compact/0.2.802) | | | | Unknown Display Name | NuGet [1.1.2-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.AzureCosmosDb.Mongo/1.1.2-preview) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 81454b75aef05..c95c6e9ce1f3f 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -16,7 +16,7 @@ | Communication Call Automation | NuGet [1.5.0](https://www.nuget.org/packages/Azure.Communication.CallAutomation/1.5.0)
NuGet [1.6.0-beta.1](https://www.nuget.org/packages/Azure.Communication.CallAutomation/1.6.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.CallAutomation-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.CallAutomation_1.5.0/sdk/communication/Azure.Communication.CallAutomation/)
GitHub [1.6.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.CallAutomation_1.6.0-beta.1/sdk/communication/Azure.Communication.CallAutomation/) | | Communication Chat | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Communication.Chat/1.4.0) | [docs](/dotnet/api/overview/azure/Communication.Chat-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Chat_1.4.0/sdk/communication/Azure.Communication.Chat/) | | Communication Common | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Communication.Common/1.4.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Common/2.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.Common-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_1.4.0/sdk/communication/Azure.Communication.Common/)
GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_2.0.0-beta.1/sdk/communication/Azure.Communication.Common/) | -| Communication Email | NuGet [1.0.2](https://www.nuget.org/packages/Azure.Communication.Email/1.0.2)
NuGet [1.1.0-beta.2](https://www.nuget.org/packages/Azure.Communication.Email/1.1.0-beta.2) | [docs](/dotnet/api/overview/azure/Communication.Email-readme) | GitHub [1.0.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.0.2/sdk/communication/Azure.Communication.Email/)
GitHub [1.1.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.1.0-beta.2/sdk/communication/Azure.Communication.Email/) | +| Communication Email | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Communication.Email/1.1.0) | [docs](/dotnet/api/overview/azure/Communication.Email-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.1.0/sdk/communication/Azure.Communication.Email/) | | Communication Identity | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Communication.Identity/1.3.1)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Identity/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.Identity-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Identity_1.3.1/sdk/communication/Azure.Communication.Identity/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Identity_1.4.0-beta.1/sdk/communication/Azure.Communication.Identity/) | | Communication JobRouter | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Communication.JobRouter/1.0.0)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Communication.JobRouter/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.JobRouter-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.JobRouter_1.0.0/sdk/communication/Azure.Communication.JobRouter/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.JobRouter_1.1.0-beta.1/sdk/communication/Azure.Communication.JobRouter/) | | Communication Messages | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Communication.Messages/1.1.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Communication.Messages/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Communication.Messages-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Messages_1.1.0/sdk/communication/Azure.Communication.Messages/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Messages_1.3.0-beta.2/sdk/communication/Azure.Communication.Messages/) | @@ -55,7 +55,7 @@ | Health Insights Cancer Profiling | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Health.Insights.CancerProfiling/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Health.Insights.CancerProfiling-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.CancerProfiling_1.0.0-beta.1/sdk/healthinsights/Azure.Health.Insights.CancerProfiling/) | | Health Insights Clinical Matching | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Health.Insights.ClinicalMatching/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Health.Insights.ClinicalMatching-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.ClinicalMatching_1.0.0-beta.1/sdk/healthinsights/Azure.Health.Insights.ClinicalMatching/) | | Health Insights Radiology Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Health.Insights.RadiologyInsights/1.1.0) | [docs](/dotnet/api/overview/azure/Health.Insights.RadiologyInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.RadiologyInsights_1.1.0/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/) | -| Identity | NuGet [1.16.0](https://www.nuget.org/packages/Azure.Identity/1.16.0) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.16.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.16.0/sdk/identity/Azure.Identity/) | +| Identity | NuGet [1.17.0](https://www.nuget.org/packages/Azure.Identity/1.17.0) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.17.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.17.0/sdk/identity/Azure.Identity/) | | Identity Broker | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Identity.Broker/1.3.0) | [docs](/dotnet/api/overview/azure/Identity.Broker-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.3.0/sdk/identity/Azure.Identity.Broker/) | | Image Analysis | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Vision.ImageAnalysis/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Vision.ImageAnalysis-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Vision.ImageAnalysis_1.0.0/sdk/vision/Azure.AI.Vision.ImageAnalysis/) | | Key Vault - Administration | NuGet [4.6.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.6.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme) | GitHub [4.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.6.0/sdk/keyvault/Azure.Security.KeyVault.Administration/) | @@ -81,7 +81,7 @@ | Monitor Query | NuGet [1.7.1](https://www.nuget.org/packages/Azure.Monitor.Query/1.7.1) | [docs](/dotnet/api/overview/azure/Monitor.Query-readme) | GitHub [1.7.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.7.1/sdk/monitor/Azure.Monitor.Query/) | | NUnit ? Microsoft Playwright Testing | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Developer.MicrosoftPlaywrightTesting.NUnit/1.0.0-beta.4) | | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Developer.MicrosoftPlaywrightTesting.NUnit_1.0.0-beta.4/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.NUnit/) | | OpenAI Assistants | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.AI.OpenAI.Assistants/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.OpenAI.Assistants-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI.Assistants_1.0.0-beta.4/sdk/openai/Azure.AI.OpenAI.Assistants/) | -| OpenAI Inference | NuGet [2.1.0](https://www.nuget.org/packages/Azure.AI.OpenAI/2.1.0)
NuGet [2.3.0-beta.2](https://www.nuget.org/packages/Azure.AI.OpenAI/2.3.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme) | GitHub [2.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.1.0/sdk/openai/Azure.AI.OpenAI/)
GitHub [2.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.3.0-beta.2/sdk/openai/Azure.AI.OpenAI/) | +| OpenAI Inference | NuGet [2.1.0](https://www.nuget.org/packages/Azure.AI.OpenAI/2.1.0)
NuGet [2.5.0-beta.1](https://www.nuget.org/packages/Azure.AI.OpenAI/2.5.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme) | GitHub [2.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.1.0/sdk/openai/Azure.AI.OpenAI/)
GitHub [2.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.5.0-beta.1/sdk/openai/Azure.AI.OpenAI/) | | OpenTelemetry AspNetCore | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.AspNetCore/1.3.0) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.AspNetCore-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.AspNetCore_1.3.0/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/) | | OpenTelemetry Exporter | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.4.0) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.Exporter-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.4.0/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/) | | OpenTelemetry LiveMetrics | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.LiveMetrics/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.LiveMetrics-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.LiveMetrics_1.0.0-beta.3/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/) | diff --git a/docs/azure/sdk/snippets/aspnetcore-guidance/MinApiSample/MinApiSample.csproj b/docs/azure/sdk/snippets/aspnetcore-guidance/MinApiSample/MinApiSample.csproj index 615b970251190..b511864d153d3 100644 --- a/docs/azure/sdk/snippets/aspnetcore-guidance/MinApiSample/MinApiSample.csproj +++ b/docs/azure/sdk/snippets/aspnetcore-guidance/MinApiSample/MinApiSample.csproj @@ -10,8 +10,8 @@ - - + +
diff --git a/docs/core/diagnostics/snippets/OTLP-Example/csharp/OTLP-Example.csproj b/docs/core/diagnostics/snippets/OTLP-Example/csharp/OTLP-Example.csproj index 4cb6a43f740d8..a6d59e73fbdfc 100644 --- a/docs/core/diagnostics/snippets/OTLP-Example/csharp/OTLP-Example.csproj +++ b/docs/core/diagnostics/snippets/OTLP-Example/csharp/OTLP-Example.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/docs/core/extensions/dependency-injection-usage.md b/docs/core/extensions/dependency-injection-usage.md index 3cfb22c88f7e8..10bd8ef219f79 100644 --- a/docs/core/extensions/dependency-injection-usage.md +++ b/docs/core/extensions/dependency-injection-usage.md @@ -105,10 +105,10 @@ Each `services.Add{LIFETIME}<{SERVICE}>` extension method adds (and potentially The app: -- Creates an instance with [host builder settings](generic-host.md#host-builder-settings). +- Creates an instance with [host builder settings](generic-host.md#host-builder-settings). - Configures services and adds them with their corresponding service lifetime. - Calls and assigns an instance of . -- Calls `ExemplifyScoping`, passing in the . +- Calls `ExemplifyServiceLifetime`, passing in the . ## Conclusion diff --git a/docs/core/extensions/snippets/workers/timer-service/App.TimerHostedService.csproj b/docs/core/extensions/snippets/workers/timer-service/App.TimerHostedService.csproj index be8b2a59799b7..d6c1fbb2707de 100644 --- a/docs/core/extensions/snippets/workers/timer-service/App.TimerHostedService.csproj +++ b/docs/core/extensions/snippets/workers/timer-service/App.TimerHostedService.csproj @@ -8,6 +8,6 @@ - + diff --git a/docs/core/testing/mstest-analyzers/mstest0001.md b/docs/core/testing/mstest-analyzers/mstest0001.md index 13622dd37ce9f..9504634516c76 100644 --- a/docs/core/testing/mstest-analyzers/mstest0001.md +++ b/docs/core/testing/mstest-analyzers/mstest0001.md @@ -23,7 +23,7 @@ dev_langs: | **Category** | Performance | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.2.0 | | **Is there a code fix** | No | diff --git a/docs/core/testing/mstest-analyzers/mstest0006.md b/docs/core/testing/mstest-analyzers/mstest0006.md index f2a91d5101228..9454fd1c7164d 100644 --- a/docs/core/testing/mstest-analyzers/mstest0006.md +++ b/docs/core/testing/mstest-analyzers/mstest0006.md @@ -27,6 +27,9 @@ dev_langs: | **Introduced in version** | 3.2.0 | | **Is there a code fix** | Yes, starting with 3.7.0 | +> [NOTE] +> This analyzer is no longer relevant for MSTest 4 as the attribute was removed. + ## Cause A method is marked with the `[ExpectedException]` attribute. diff --git a/docs/core/testing/mstest-analyzers/mstest0007.md b/docs/core/testing/mstest-analyzers/mstest0007.md index 13b0ed4bd6d3d..25b4c8fa146e4 100644 --- a/docs/core/testing/mstest-analyzers/mstest0007.md +++ b/docs/core/testing/mstest-analyzers/mstest0007.md @@ -20,7 +20,7 @@ ms.author: copoiena | **Category** | Usage | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.3.0 | | **Is there a code fix** | Yes | diff --git a/docs/core/testing/mstest-analyzers/mstest0017.md b/docs/core/testing/mstest-analyzers/mstest0017.md index 7d9bbe17611be..469a3c40cbc78 100644 --- a/docs/core/testing/mstest-analyzers/mstest0017.md +++ b/docs/core/testing/mstest-analyzers/mstest0017.md @@ -20,7 +20,7 @@ ms.author: amauryleve | **Category** | Usage | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.4.0 | | **Is there a code fix** | Yes | diff --git a/docs/core/testing/mstest-analyzers/mstest0023.md b/docs/core/testing/mstest-analyzers/mstest0023.md index 504b6586b718d..17946ff5c995c 100644 --- a/docs/core/testing/mstest-analyzers/mstest0023.md +++ b/docs/core/testing/mstest-analyzers/mstest0023.md @@ -13,16 +13,16 @@ ms.author: amauryleve --- # MSTEST0023: Do not negate boolean assertions -| Property | Value | -|-------------------------------------|----------------------------------| -| **Rule ID** | MSTEST0023 | -| **Title** | Do not negate boolean assertions | -| **Category** | Usage | -| **Fix is breaking or non-breaking** | Non-breaking | -| **Enabled by default** | Yes | -| **Default severity** | Info | -| **Introduced in version** | 3.4.0 | -| **Is there a code fix** | No | +| Property | Value | +|-------------------------------------|------------------------------------------| +| **Rule ID** | MSTEST0023 | +| **Title** | Do not negate boolean assertions | +| **Category** | Usage | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default** | Yes | +| **Default severity** | Warning starting with 4.0.0, Info before | +| **Introduced in version** | 3.4.0 | +| **Is there a code fix** | No | ## Cause diff --git a/docs/core/testing/mstest-analyzers/mstest0024.md b/docs/core/testing/mstest-analyzers/mstest0024.md index af6c9f123d740..564962ea42a0b 100644 --- a/docs/core/testing/mstest-analyzers/mstest0024.md +++ b/docs/core/testing/mstest-analyzers/mstest0024.md @@ -20,7 +20,7 @@ ms.author: amauryleve | **Category** | Usage | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.4.0 | | **Is there a code fix** | No | diff --git a/docs/core/testing/mstest-analyzers/mstest0025.md b/docs/core/testing/mstest-analyzers/mstest0025.md index 51209a0ec7677..07c640092a4e3 100644 --- a/docs/core/testing/mstest-analyzers/mstest0025.md +++ b/docs/core/testing/mstest-analyzers/mstest0025.md @@ -17,10 +17,10 @@ ms.author: amauryleve |-------------------------------------|-------------------------------------------------------| | **Rule ID** | MSTEST0025 | | **Title** | Use 'Assert.Fail' instead of an always-failing assert | -| **Category** | Design | +| **Category** | Usage | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.4.0 | | **Is there a code fix** | Yes | diff --git a/docs/core/testing/mstest-analyzers/mstest0030.md b/docs/core/testing/mstest-analyzers/mstest0030.md index a9ca000a7e81f..71b7548241a59 100644 --- a/docs/core/testing/mstest-analyzers/mstest0030.md +++ b/docs/core/testing/mstest-analyzers/mstest0030.md @@ -20,7 +20,7 @@ ms.author: enjieid | **Category** | Usage | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.5.0 | | **Is there a code fix** | No | diff --git a/docs/core/testing/mstest-analyzers/mstest0031.md b/docs/core/testing/mstest-analyzers/mstest0031.md index bcfca12544eb0..a6199daa1407c 100644 --- a/docs/core/testing/mstest-analyzers/mstest0031.md +++ b/docs/core/testing/mstest-analyzers/mstest0031.md @@ -20,7 +20,7 @@ ms.author: enjieid | **Category** | Usage | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.5.0 | | **Is there a code fix** | No | diff --git a/docs/core/testing/mstest-analyzers/mstest0032.md b/docs/core/testing/mstest-analyzers/mstest0032.md index cce0b1fc46cb9..7b41e855653c8 100644 --- a/docs/core/testing/mstest-analyzers/mstest0032.md +++ b/docs/core/testing/mstest-analyzers/mstest0032.md @@ -20,7 +20,7 @@ ms.author: enjieid | **Category** | Usage | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.5.0 | | **Is there a code fix** | No | diff --git a/docs/core/testing/mstest-analyzers/mstest0034.md b/docs/core/testing/mstest-analyzers/mstest0034.md index 5642895457da8..f07e10d31fa3e 100644 --- a/docs/core/testing/mstest-analyzers/mstest0034.md +++ b/docs/core/testing/mstest-analyzers/mstest0034.md @@ -24,6 +24,9 @@ ms.author: enjieid | **Introduced in version** | 3.6.0 | | **Is there a code fix** | No | +> [NOTE] +> This analyzer is no longer relevant for MSTest 4 as `ClassCleanupBehavior` was removed. + ## Cause This rule raises a diagnostic when `ClassCleanupBehavior.EndOfClass` isn't set with the `[ClassCleanup]`. diff --git a/docs/core/testing/mstest-analyzers/mstest0035.md b/docs/core/testing/mstest-analyzers/mstest0035.md index 8f7cd315d3f7f..507a59a7047ef 100644 --- a/docs/core/testing/mstest-analyzers/mstest0035.md +++ b/docs/core/testing/mstest-analyzers/mstest0035.md @@ -20,7 +20,7 @@ ms.author: enjieid | **Category** | Usage | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.6.0 | | **Is there a code fix** | No | diff --git a/docs/core/testing/mstest-analyzers/mstest0037.md b/docs/core/testing/mstest-analyzers/mstest0037.md index 7194da83ff2c2..a677a84a72f6d 100644 --- a/docs/core/testing/mstest-analyzers/mstest0037.md +++ b/docs/core/testing/mstest-analyzers/mstest0037.md @@ -20,7 +20,7 @@ ms.author: ygerges | **Category** | Usage | | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | -| **Default severity** | Info | +| **Default severity** | Warning starting with 4.0.0, Info before | | **Introduced in version** | 3.7.0 | | **Is there a code fix** | Yes | diff --git a/docs/core/testing/mstest-analyzers/mstest0039.md b/docs/core/testing/mstest-analyzers/mstest0039.md index e43eaad0bb8d2..bbe3078613846 100644 --- a/docs/core/testing/mstest-analyzers/mstest0039.md +++ b/docs/core/testing/mstest-analyzers/mstest0039.md @@ -24,6 +24,9 @@ ms.author: ygerges | **Introduced in version** | 3.8.0 | | **Is there a code fix** | Yes | +> [NOTE] +> This analyzer is no longer relevant for MSTest 4 as the old assertion APIs were removed. + ## Cause The use of `Assert.ThrowsException` or `Assert.ThrowsExceptionAsync`, which are no longer recommended. diff --git a/docs/core/testing/mstest-analyzers/mstest0045.md b/docs/core/testing/mstest-analyzers/mstest0045.md index c43e8b464f7ac..bdc4cd8e65a8b 100644 --- a/docs/core/testing/mstest-analyzers/mstest0045.md +++ b/docs/core/testing/mstest-analyzers/mstest0045.md @@ -13,16 +13,16 @@ ms.author: amauryleve --- # MSTEST0045: Use cooperative cancellation for timeout -| Property | Value | -|-------------------------------------|------------------------------------------------------------------------------------------| -| **Rule ID** | MSTEST0045 | -| **Title** | Use cooperative cancellation for timeout | -| **Category** | Design | -| **Fix is breaking or non-breaking** | Non-breaking | -| **Enabled by default** | Yes | -| **Default severity** | Info | -| **Introduced in version** | 3.10.0 | -| **Is there a code fix** | Yes | +| Property | Value | +|-------------------------------------|------------------------------------------| +| **Rule ID** | MSTEST0045 | +| **Title** | Use cooperative cancellation for timeout | +| **Category** | Usage | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default** | Yes | +| **Default severity** | Warning starting with 4.0.0, Info before | +| **Introduced in version** | 3.10.0 | +| **Is there a code fix** | Yes | ## Cause diff --git a/docs/core/testing/mstest-analyzers/mstest0053.md b/docs/core/testing/mstest-analyzers/mstest0053.md index b44274a561549..eac408e4daa2d 100644 --- a/docs/core/testing/mstest-analyzers/mstest0053.md +++ b/docs/core/testing/mstest-analyzers/mstest0053.md @@ -25,6 +25,9 @@ ai-usage: ai-generated | **Introduced in version** | 3.11.0 | | **Is there a code fix** | Yes | +> [NOTE] +> This analyzer is no longer relevant for MSTest 4 as the assertion APIs with format parameters were removed. + ## Cause An assertion method call uses the `message` and `parameters` arguments for string formatting instead of using string interpolation. diff --git a/docs/core/testing/snippets/order-unit-tests/csharp/MSTest.Project/MSTest.Project.csproj b/docs/core/testing/snippets/order-unit-tests/csharp/MSTest.Project/MSTest.Project.csproj index 2146534aa0f02..d54f41adefc51 100644 --- a/docs/core/testing/snippets/order-unit-tests/csharp/MSTest.Project/MSTest.Project.csproj +++ b/docs/core/testing/snippets/order-unit-tests/csharp/MSTest.Project/MSTest.Project.csproj @@ -8,9 +8,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/docs/core/testing/snippets/order-unit-tests/csharp/NUnit.TestProject/NUnit.Project.csproj b/docs/core/testing/snippets/order-unit-tests/csharp/NUnit.TestProject/NUnit.Project.csproj index 0f4a8e25b0006..200fe51b3aa1e 100644 --- a/docs/core/testing/snippets/order-unit-tests/csharp/NUnit.TestProject/NUnit.Project.csproj +++ b/docs/core/testing/snippets/order-unit-tests/csharp/NUnit.TestProject/NUnit.Project.csproj @@ -9,8 +9,8 @@ - - + + all runtime; build; native; contentfiles; analyzers diff --git a/docs/core/testing/snippets/order-unit-tests/csharp/XUnit.TestProject/XUnit.Project.csproj b/docs/core/testing/snippets/order-unit-tests/csharp/XUnit.TestProject/XUnit.Project.csproj index fb1340ef32e68..0d8a23f54af35 100644 --- a/docs/core/testing/snippets/order-unit-tests/csharp/XUnit.TestProject/XUnit.Project.csproj +++ b/docs/core/testing/snippets/order-unit-tests/csharp/XUnit.TestProject/XUnit.Project.csproj @@ -8,7 +8,7 @@ - + all diff --git a/docs/core/testing/unit-testing-mstest-migration-v3-v4.md b/docs/core/testing/unit-testing-mstest-migration-v3-v4.md index 3ad4f96c01bc8..ec4de037f2b96 100644 --- a/docs/core/testing/unit-testing-mstest-migration-v3-v4.md +++ b/docs/core/testing/unit-testing-mstest-migration-v3-v4.md @@ -8,7 +8,7 @@ ms.date: 07/22/2025 # Migrate from MSTest v3 to MSTest v4 -The preview version MSTest v4 is now available. This migration guide explores what's changed in MSTest v4 and how you can migrate to this version. +The stable version MSTest v4 is now available. This migration guide explores what's changed in MSTest v4 and how you can migrate to this version. > [!NOTE] > Generally speaking, MSTest v4 isn't binary compatible with MSTest v3. Any library compiled against v3 must be recompiled against v4. @@ -172,6 +172,23 @@ The property was added on individual data sources like `DataRowAttribute` and `D The `ConditionBaseAttribute.ShouldRun` property was renamed to `IsConditionMet`. That makes it clearer that `ConditionMode` shouldn't be used in the implementation. +### Multiple analyzers are updated to be warning by default + +The default severity of the following analyzers changed from Info to Warning: + +- [MSTEST0001](./mstest-analyzers/mstest0001.md) +- [MSTEST0007](./mstest-analyzers/mstest0007.md) +- [MSTEST0017](./mstest-analyzers/mstest0017.md) +- [MSTEST0023](./mstest-analyzers/mstest0023.md) +- [MSTEST0024](./mstest-analyzers/mstest0024.md) +- [MSTEST0025](./mstest-analyzers/mstest0025.md) +- [MSTEST0030](./mstest-analyzers/mstest0030.md) +- [MSTEST0031](./mstest-analyzers/mstest0031.md) +- [MSTEST0032](./mstest-analyzers/mstest0032.md) +- [MSTEST0035](./mstest-analyzers/mstest0035.md) +- [MSTEST0037](./mstest-analyzers/mstest0037.md) +- [MSTEST0045](./mstest-analyzers/mstest0045.md) + ## Behavior breaking changes These are breaking changes that might affect the behavior at run time. diff --git a/docs/core/tools/dotnet-restore.md b/docs/core/tools/dotnet-restore.md index cdb46e99542f9..5058a7c8c656a 100644 --- a/docs/core/tools/dotnet-restore.md +++ b/docs/core/tools/dotnet-restore.md @@ -18,7 +18,7 @@ dotnet restore [||] [-a|--arch ] [--configfile ] [--disable-build-servers] [--disable-parallel] [-f|--force] [--force-evaluate] [--ignore-failed-sources] [--interactive] [--lock-file-path ] - [--locked-mode] [--no-cache] [--no-dependencies] [--no-http-cache] + [--locked-mode] [--no-dependencies] [--no-http-cache] [--os ] [--packages ] [-r|--runtime ] [-s|--source ] [--tl:[auto|on|off]] [--ucr|--use-current-runtime] [--use-lock-file] @@ -123,10 +123,6 @@ There are three specific settings that `dotnet restore` ignores: Don't allow updating project lock file. -- **`--no-cache`** - - Specifies to not cache HTTP requests. - - **`--no-dependencies`** When restoring a project with project-to-project (P2P) references, restores the root project and not the references. diff --git a/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTest/StringLibraryTest.csproj b/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTest/StringLibraryTest.csproj index 110b279cc5e07..34a2a0e158438 100644 --- a/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTest/StringLibraryTest.csproj +++ b/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTest/StringLibraryTest.csproj @@ -7,7 +7,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/docs/csharp/language-reference/compiler-messages/cs0163.md b/docs/csharp/language-reference/compiler-messages/cs0163.md index 2be35de536d14..27095b7632c95 100644 --- a/docs/csharp/language-reference/compiler-messages/cs0163.md +++ b/docs/csharp/language-reference/compiler-messages/cs0163.md @@ -47,13 +47,35 @@ public class MyClass case 3: i = 0; - return; - - // Compiler error CS0163 is reported on the following line. + break; + default: Console.WriteLine("Default"); - // To resolve the error, uncomment the following line: - //break; + break; } } +} +``` + +Note that it is correct to have several `case`s for one implementation, like in the following snippet: + +```csharp +public class MyClass +{ + public static void Main() + { + int i = 0; + + switch(i) + { + case 1: + case 2: // No CS0163 + i++ + break; + + default: + break; + } + } +} ``` diff --git a/docs/csharp/language-reference/compiler-messages/cs1029.md b/docs/csharp/language-reference/compiler-messages/cs1029.md deleted file mode 100644 index 1c07e0e7c66a6..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1029.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: "Compiler Error CS1029" -title: "Compiler Error CS1029" -ms.date: 07/20/2015 -f1_keywords: - - "CS1029" -helpviewer_keywords: - - "CS1029" -ms.assetid: 61bd4d44-9bfc-42bb-a9f0-a0683da53640 ---- -# Compiler Error CS1029 - -\#error: 'text' - -Displays the text of an error defined with the [#error](../preprocessor-directives.md#error-and-warning-information) directive. - -The following sample shows how to create a user-defined error: - -```csharp -// CS1029.cs -class Sample -{ - static void Main() - { - #error Let's give an error here // CS1029 - } -} -``` - -Compilation produces the following output: - -```console -example.cs(9,8): error CS1029: #error: 'Let's give an error here // CS1029 ' -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs1691.md b/docs/csharp/language-reference/compiler-messages/cs1691.md deleted file mode 100644 index 22d63b48b3136..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1691.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: "Compiler Warning (level 1) CS1691" -title: "Compiler Warning (level 1) CS1691" -ms.date: 07/20/2015 -f1_keywords: - - "CS1691" -helpviewer_keywords: - - "CS1691" -ms.assetid: 7f0fea4d-4215-446c-a249-57daa7e967d2 ---- -# Compiler Warning (level 1) CS1691 - -'number' is not a valid warning number - - A number that was passed to the [#pragma warning](../preprocessor-directives.md#pragma-warning) preprocessor directive was not a valid warning number. Verify that the number represents a warning, not an error or another sequence of characters. - -## Example - - The following example generates CS1691. - -```csharp -// CS1691.cs -public class C -{ - int i = 1; - public static void Main() - { - C myC = new C(); -#pragma warning disable 151 // CS1691 -// Try the following line instead: -// #pragma warning disable 1645 - myC.i++; -#pragma warning restore 151 // CS1691 -// Try the following line instead: -// #pragma warning restore 1645 - } -} -``` diff --git a/docs/csharp/language-reference/compiler-messages/nullable-warnings.md b/docs/csharp/language-reference/compiler-messages/nullable-warnings.md index 0d35943a6ce72..759115dea1396 100644 --- a/docs/csharp/language-reference/compiler-messages/nullable-warnings.md +++ b/docs/csharp/language-reference/compiler-messages/nullable-warnings.md @@ -98,6 +98,7 @@ helpviewer_keywords: - "CS8634" - "CS8636" - "CS8637" + - "CS8668" - "CS8639" - "CS8643" - "CS8644" @@ -214,6 +215,7 @@ The following warnings indicate that you haven't set the nullable context correc - **CS8632** - *The annotation for nullable reference types should only be used in code within a `#nullable` annotations context.* - **CS8636** - *Invalid option for `/nullable`; must be `disable`, `enable`, `warnings` or `annotations`* - **CS8637** - *Expected `enable`, `disable`, or `restore`* +- **CS8668** - *Expected `warnings`, `annotations`, or end of directive* To set the nullable context correctly, you have two options: diff --git a/docs/csharp/language-reference/compiler-messages/preprocessor-errors.md b/docs/csharp/language-reference/compiler-messages/preprocessor-errors.md new file mode 100644 index 0000000000000..8b8d03f377a41 --- /dev/null +++ b/docs/csharp/language-reference/compiler-messages/preprocessor-errors.md @@ -0,0 +1,442 @@ +--- +title: Errors and warnings generated by the C# preprocessor +description: Learn how to diagnose and fix errors related to preprocessor tokens how they're used in C# source files. +f1_keywords: + - "CS1024" + - "CS1025" + - "CS1027" + - "CS1028" + - "CS1029" + - "CS1030" + - "CS1032" + - "CS1038" + - "CS1040" + - "CS1517" + - "CS1560" + - "CS1576" + - "CS1578" + - "CS1633" + - "CS1634" + - "CS1635" + - "CS1691" + - "CS1692" + - "CS1694" + - "CS1695" + - "CS1696" + - "CS1709" + - "CS7009" + - "CS7010" + - "CS7011" + - "CS8097" + - "CS8098" + - "CS8938" + - "CS8939" + - "CS8996" + - "CS9028" + - "CS9297" + - "CS9298" + - "CS9299" + - "CS9314" +helpviewer_keywords: + - "CS1024" + - "CS1025" + - "CS1027" + - "CS1028" + - "CS1029" + - "CS1030" + - "CS1032" + - "CS1038" + - "CS1040" + - "CS1517" + - "CS1560" + - "CS1576" + - "CS1578" + - "CS1633" + - "CS1634" + - "CS1635" + - "CS1691" + - "CS1692" + - "CS1694" + - "CS1695" + - "CS1696" + - "CS1709" + - "CS7009" + - "CS7010" + - "CS7011" + - "CS8097" + - "CS8098" + - "CS8938" + - "CS8939" + - "CS8996" + - "CS9028" + - "CS9297" + - "CS9298" + - "CS9299" + - "CS9314" +ms.date: 10/07/2025 +ai-usage: ai-assisted +--- +# Preprocessor errors and warnings + +The compiler generates the following errors for incorrect use of preprocessor directives: + +- [**CS1024**](#invalid-preprocessor-directive-syntax): *Preprocessor directive expected* +- [**CS1025**](#invalid-preprocessor-directive-syntax): *Single-line comment or end-of-line expected* +- [**CS1027**](#invalid-preprocessor-directive-syntax): *#endif directive expected* +- [**CS1028**](#invalid-preprocessor-directive-syntax): *Unexpected preprocessor directive* +- [**CS1029**](#error-and-warning-directive-errors): *#error: 'text'* +- [**CS1030**](#error-and-warning-directive-errors): *#warning: 'text'* +- [**CS1032**](#invalid-preprocessor-directive-syntax): *Cannot define/undefine preprocessor symbols after first token in file* +- [**CS1038**](#invalid-preprocessor-directive-syntax): *#endregion directive expected* +- [**CS1040**](#invalid-preprocessor-directive-syntax): *Preprocessor directives must appear as the first non-white-space character on a line* +- [**CS1517**](#invalid-preprocessor-directive-syntax): *Invalid preprocessor expression* +- [**CS1560**](#line-and-file-directive-errors): *Invalid filename specified for preprocessor directive. Filename is too long or not a valid filename* +- [**CS1576**](#line-and-file-directive-errors): *The line number specified for #line directive is missing or invalid* +- [**CS1578**](#line-and-file-directive-errors): *Filename, single-line comment or end-of-line expected* +- [**CS1633**](#invalid-preprocessor-directive-syntax): *Unrecognized #pragma directive* +- [**CS1634**](#error-and-warning-directive-errors): *Expected disable or restore* +- [**CS1635**](#error-and-warning-directive-errors): *Cannot restore warning 'warning code' because it was disabled globally* +- [**CS1691**](#error-and-warning-directive-errors): *'number' is not a valid warning number* +- [**CS1692**](#error-and-warning-directive-errors): *Invalid number* +- [**CS1694**](#line-and-file-directive-errors): *Invalid filename specified for preprocessor directive. Filename is too long or not a valid filename* +- [**CS1695**](#line-and-file-directive-errors): *Invalid #pragma checksum syntax; should be #pragma checksum "filename" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" "XXXX..."* +- [**CS1696**](#invalid-preprocessor-directive-syntax): *Single-line comment or end-of-line expected* +- [**CS1709**](#line-and-file-directive-errors): *Filename specified for preprocessor directive is empty* +- [**CS7009**](#file-contains-scriptcs-directives): *Cannot use #r after first token in file* +- [**CS7010**](#file-contains-scriptcs-directives): *Quoted file name expected* +- [**CS7011**](#file-contains-scriptcs-directives): *#r is only allowed in scripts* +- [**CS8097**](#file-contains-scriptcs-directives): *#load is only allowed in scripts* +- [**CS8098**](#file-contains-scriptcs-directives): *Cannot use #load after first token in file* +- [**CS8938**](#line-and-file-directive-errors): *The #line directive value is missing or out of range* +- [**CS8939**](#line-and-file-directive-errors): *The #line directive end position must be greater than or equal to the start position* +- [**CS8996**](#invalid-preprocessor-directive-syntax): *Raw string literals are not allowed in preprocessor directives* +- [**CS9028**](#line-and-file-directive-errors): *The #line span directive requires space before the first parenthesis, before the character offset, and before the file name* +- [**CS9297**](#incorrect-use-of-file-based-apps-directives): *`#:` directives cannot be after first token in file* +- [**CS9298**](#incorrect-use-of-file-based-apps-directives): *`#:` directives can be only used in file-based programs (`-features:FileBasedProgram`)* +- [**CS9299**](#incorrect-use-of-file-based-apps-directives): *`#:` directives cannot be after `#if` directive* +- [**CS9314**](#incorrect-use-of-file-based-apps-directives): *`#!` directives can be only used in scripts or file-based programs* + +## Invalid preprocessor directive syntax + +- **CS1024**: *Preprocessor directive expected* +- **CS1025**: *Single-line comment or end-of-line expected* +- **CS1027**: *#endif directive expected* +- **CS1028**: *Unexpected preprocessor directive* +- **CS1038**: *#endregion directive expected* +- **CS1040**: *Preprocessor directives must appear as the first non-white-space character on a line* +- **CS1517**: *Invalid preprocessor expression* +- **CS1633**: *Unrecognized #pragma directive* +- **CS1696**: *Single-line comment or end-of-line expected* +- **CS8996**: *Raw string literals are not allowed in preprocessor directives* + +These errors indicate that you used invalid syntax for [preprocessor directives](../preprocessor-directives.md). Common causes include: + +- Using an unrecognized directive after `#` (CS1024, CS1633). +- Including multiline comments on directive lines (CS1025, CS1696). +- Using directives in unexpected locations (CS1028). +- Missing required matching directives (CS1027, CS1038). +- Not defining or undefining symbols as the first token in the file (CS1032) +- Not placing the directive as the first token on a line (CS1040). +- Using invalid expressions in conditional compilation (CS1517). +- Using raw string literals in preprocessor directives (CS8996). + +**CS1024 example - Preprocessor directive expected:** + +```csharp +#import System // CS1024 - "import" is not a valid directive +``` + +**CS1025 example - Single-line comment or end-of-line expected:** + +```csharp +#if true /* hello +*/ // CS1025 - multiline comment not allowed +#endif +``` + +**CS1027 example - #endif directive expected:** + +```csharp +#if true // CS1027 - missing #endif +class Test { } +``` + +**CS1028 example - Unexpected preprocessor directive:** + +```csharp +#endif // CS1028 - no matching #if +``` + +**CS1032 example - `#define` and `#undef` preprocessor directives must appear before other tokens:** + +```csharp +/* Comment */ +#define X // CS1032 - directive not first token in file +``` + +**CS1038 example - #endregion directive expected:** + +```csharp +#region testing +class Test { } +// CS1038 - missing #endregion +``` + +**CS1040 example - Preprocessor directives must appear as the first non-white-space character:** + +```csharp +/* Comment */ #define X // CS1040 - directive not first on line +``` + +**CS1517 example - Invalid preprocessor expression:** + +```csharp +#if 1 // CS1517 - numeric literals not allowed +#endif +#if ~symbol // CS1517 - bitwise operators not allowed +#endif +``` + +**CS1633 example - Unrecognized #pragma directive:** + +```csharp +#pragma unknown // CS1633 - "unknown" is not a valid pragma +``` + +**CS8996 example - Raw string literals are not allowed in preprocessor directives:** + +```csharp +// CS8996.cs +#pragma checksum """raw_string""" "{406EA660-64CF-4C82-B6F0-42D48172A799}" "hash" // CS8996 +class Test { } +``` + +To fix this error, use a regular string literal: + +```csharp +#pragma checksum "filename.cs" "{406EA660-64CF-4C82-B6F0-42D48172A799}" "hash" // OK +class Test { } +``` + +To fix these errors, ensure your preprocessor directives follow the correct syntax rules described in the [preprocessor directives documentation](../preprocessor-directives.md). + +## #error and #warning directive errors + +- **CS1029**: *#error: 'text'* +- **CS1030**: *#warning: 'text'* +- **CS1634**: *Expected disable or restore* +- **CS1635**: *Cannot restore warning 'warning code' because it was disabled globally* +- **CS1691**: *'number' is not a valid warning number* +- **CS1692**: *Invalid number* + +These errors occur when the compiler processes [`#error`](../preprocessor-directives.md#error-and-warning-information), [`#warning`](../preprocessor-directives.md#error-and-warning-information), and [`#pragma warning`](../preprocessor-directives.md#pragma-warning) directives. These directives allow you to generate custom error and warning messages during compilation and control warning behavior. + +**CS1029** displays the text of an error defined with the `#error` directive: + +```csharp +// CS1029.cs +class Sample +{ + static void Main() + { + #error Let's give an error here // CS1029 + } +} +``` + +Compilation produces the following output: + +```console +example.cs(9,8): error CS1029: #error: 'Let's give an error here // CS1029 ' +``` + +**CS1030** displays the text of a warning defined with the `#warning` directive: + +```csharp +// CS1030.cs +class Sample +{ + static void Main() + { + #warning Let's give a warning here + } +} +``` + +Compilation produces the following output: + +```console +example.cs(6,16): warning CS1030: #warning: 'Let's give a warning here' +``` + +**CS1634** occurs when a `#pragma warning` clause is badly formed, such as when disable or restore is omitted: + +```csharp +// CS1634.cs +// compile with: /W:1 + +#pragma warning // CS1634 +// Try this instead: +// #pragma warning disable 0219 + +class MyClass +{ + public static void Main() + { + } +} +``` + +**CS1635** occurs when you use the `/nowarn` command line option or project setting to disable a warning globally, but use `#pragma warning restore` to attempt to restore that warning: + +```csharp +// CS1635.cs +// compile with: /w:1 /nowarn:162 + +enum MyEnum {one=1,two=2,three=3}; + +class MyClass +{ + public static void Main() + { +#pragma warning disable 162 + + if (MyEnum.three == MyEnum.two) + System.Console.WriteLine("Duplicate"); + +#pragma warning restore 162 // CS1635 + } +} +``` + +**CS1691** occurs when a number passed to the `#pragma warning` directive is not a valid warning number: + +```csharp +// CS1691.cs +public class C +{ + int i = 1; + public static void Main() + { + C myC = new C(); +#pragma warning disable 151 // CS1691 +// Try the following line instead: +// #pragma warning disable 1645 + myC.i++; +#pragma warning restore 151 // CS1691 +// Try the following line instead: +// #pragma warning restore 1645 + } +} +``` + +**CS1692** occurs when a number in preprocessor directives like `#pragma` and `#line` is invalid because it's too large, in the wrong format, or contains illegal characters: + +```csharp +// CS1692.cs + +#pragma warning disable a // CS1692 +// Try this instead: +// #pragma warning disable 1691 + +class A +{ + static void Main() + { + } +} +``` + +These directives are useful for conditional compilation scenarios where you want to alert developers about specific conditions in the code, or control which warnings are displayed during compilation. For more information about using these directives, see the [preprocessor directives documentation](../preprocessor-directives.md#error-and-warning-information) and [#pragma warning](../preprocessor-directives.md#pragma-warning). + +## `#line` and file directive errors + +- **CS1560**: *Invalid filename specified for preprocessor directive. Filename is too long or not a valid filename* +- **CS1576**: *The line number specified for #line directive is missing or invalid* +- **CS1578**: *Filename, single-line comment or end-of-line expected* +- **CS1694**: *Invalid filename specified for preprocessor directive. Filename is too long or not a valid filename* +- **CS1695**: *Invalid #pragma checksum syntax; should be #pragma checksum "filename" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" "XXXX..."* +- **CS1709**: *Filename specified for preprocessor directive is empty* +- **CS8938**: *The #line directive value is missing or out of range* +- **CS8939**: *The #line directive end position must be greater than or equal to the start position* +- **CS9028**: *The #line span directive requires space before the first parenthesis, before the character offset, and before the file name* + +These errors indicate incorrect usage of the [`#line` directive](../preprocessor-directives.md#error-and-warning-information) or file-related preprocessor directives. Common causes include: + +- Invalid or missing filenames (CS1560, CS1694, CS1709). +- Incorrect line number format or values (CS1576, CS8938, CS8939). +- Missing proper syntax for filenames and comments (CS1578). +- Malformed `#pragma checksum` syntax (CS1695). +- Improper spacing in `#line` span directives (CS9028). + +**CS1560/CS1694 example - Invalid filename specified:** + +```csharp +#line 100 "MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890.txt" // CS1560/CS1694 - filename too long +``` + +**CS1576 example - Line number missing or invalid:** + +```csharp +#line "abc.sc" // CS1576 - missing line number +#line abc "file.cs" // CS1576 - invalid line number format +``` + +**CS1578 example - Filename, comment or end-of-line expected:** + +```csharp +#line 101 abc.cs // CS1578 - filename not quoted +``` + +**CS1695 example - Invalid #pragma checksum syntax:** + +```csharp +#pragma checksum "12345" // CS1695 - missing GUID and checksum +``` + +**CS1709 example - Empty filename:** + +```csharp +#pragma checksum "" "{406EA660-64CF-4C82-B6F0-42D48172A799}" "" // CS1709 - empty filename +``` + +**CS8938 example - #line directive value missing or out of range:** + +```csharp +#line // CS8938 - missing value +#line 0 // CS8938 - out of range (must be 1-16,707,566) +``` + +**CS8939 example - #line end position error:** + +```csharp +#line (1, 10) - (1, 5) "file.cs" // CS8939 - end column < start column +``` + +**CS9028 example - #line span directive spacing:** + +```csharp +#line(1, 1) - (1, 10)"file.cs" // CS9028 - missing spaces +``` + +To fix these errors, ensure your `#line` directives and file-related preprocessor directives follow the correct syntax as described in the [preprocessor directives documentation](../preprocessor-directives.md). + +## Incorrect use of file-based apps directives + +- **CS9297**: *`#:` directives cannot be after first token in file* +- **CS9298**: *`#:` directives can be only used in file-based programs (`-features:FileBasedProgram`)* +- **CS9299**: *`#:` directives cannot be after `#if` directive* +- **CS9314**: *`#!` directives can be only used in scripts or file-based programs* + +These errors indicate that you used the `#:` directives for a file-based app incorrectly. You can learn more about the syntax for these directives in the article on [preprocessor directives](../preprocessor-directives.md#file-based-apps) in the section on file-based apps. Or, you can explore file based apps by following the [tutorial](../../fundamentals/tutorials/file-based-programs.md) on file-based apps. + +## File contains script.cs directives + +The following errors indicate [script.cs](https://scriptcs.net) syntax in a compiled C# file: + +- **CS7009**: *Cannot use #r after first token in file* +- **CS7010**: *Quoted file name expected* +- **CS7011**: *#r is only allowed in scripts* +- **CS8097**: *#load is only allowed in scripts* + +These directives aren't supported in compiled C#. You must remove them, or use [script.cs](http://scriptcs.net/). diff --git a/docs/csharp/language-reference/preprocessor-directives.md b/docs/csharp/language-reference/preprocessor-directives.md index 46a9fc9cea794..6d6f0625fee15 100644 --- a/docs/csharp/language-reference/preprocessor-directives.md +++ b/docs/csharp/language-reference/preprocessor-directives.md @@ -299,7 +299,7 @@ You instruct the compiler to generate user-defined compiler errors and warnings, - `#warning`: Generate a compiler warning, with a specific message. - `#line`: Change the line number printed with compiler messages. -`#error` lets you generate a [CS1029](compiler-messages/cs1029.md) user-defined error from a specific location in your code. For example: +`#error` lets you generate a [CS1029](compiler-messages/preprocessor-errors.md) user-defined error from a specific location in your code. For example: ```csharp #error Deprecated code in this method. @@ -308,7 +308,7 @@ You instruct the compiler to generate user-defined compiler errors and warnings, > [!NOTE] > The compiler treats `#error version` in a special way and reports a compiler error, CS8304, with a message containing the used compiler and language versions. -`#warning` lets you generate a [CS1030](../misc/cs1030.md) level one compiler warning from a specific location in your code. For example: +`#warning` lets you generate a [CS1030](compiler-messages/preprocessor-errors.md) level one compiler warning from a specific location in your code. For example: ```csharp #warning Deprecated code in this method. diff --git a/docs/csharp/language-reference/statements/using.md b/docs/csharp/language-reference/statements/using.md index afe67b89d0db2..10b93e6601e12 100644 --- a/docs/csharp/language-reference/statements/using.md +++ b/docs/csharp/language-reference/statements/using.md @@ -37,6 +37,8 @@ When you declare several instances in one `using` statement, they are disposed i You can also use the `using` statement and declaration with an instance of a [ref struct](../builtin-types/ref-struct.md) that fits the disposable pattern. That is, it has an instance `Dispose` method that's accessible, parameterless, and has a `void` return type. +A `return` inside a `using` block still guarantees disposal, the compiler rewrites it into a `try/finally`, so the resource’s `Dispose` is always called before the method actually returns. + The `using` statement can also be of the following form: ```csharp diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index 4478184281dab..a36c3d6996e81 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -460,6 +460,11 @@ items: - name: C# compiler messages href: ./compiler-messages/index.md items: + - name: Preprocessor errors + href: ./compiler-messages/preprocessor-errors.md + displayName: > + CS1024, CS1025, CS1027, CS1028, CS1029, CS1030, CS1032, CS1038, CS1040, CS1517, CS1560, CS1576, CS1578, CS1633, CS1634, + CS1635, CS1691, CS1692, CS1694, CS1695, CS1696, CS1709, CS9297, CS9298, CS9299, CS9314 - name: Feature or version missing href: ./compiler-messages/feature-version-errors.md displayName: > diff --git a/docs/csharp/misc/cs0436.md b/docs/csharp/misc/cs0436.md index 725d6c09b1393..c4e91877ab761 100644 --- a/docs/csharp/misc/cs0436.md +++ b/docs/csharp/misc/cs0436.md @@ -1,7 +1,7 @@ --- description: "Compiler Warning (level 2) CS0436" title: "Compiler Warning (level 2) CS0436" -ms.date: 07/20/2015 +ms.date: 10/01/2025 f1_keywords: - "CS0436" helpviewer_keywords: @@ -12,9 +12,23 @@ ms.assetid: c4135d9d-3511-4bbc-9540-48c2091f869c The type 'type' in 'assembly' conflicts with the imported type 'type2' in 'assembly'. Using the type defined in 'assembly'. - This warning is issued when a type in a source file (file_2) conflicts with an imported type in file_1. The compiler uses the one in the source file. +This warning occurs when a type defined in your source code has the same fully qualified name (namespace and type name) as a type imported from a referenced assembly. When this name conflict occurs, the compiler uses the locally defined type from your source file and ignores the imported type. + +## What constitutes a conflict + +A conflict occurs when two types have identical fully qualified names, meaning: + +- They have the same namespace +- They have the same type name +- They're both accessible in the current compilation context + +The conflict is determined solely by the type's fully qualified name, not by its implementation details. Two types with the same name but different implementations (such as different methods, properties, or field values) still conflict. The compiler can't use both types simultaneously because they have the same identity. -## Example 1 +## Example + +The following example demonstrates CS0436. In this scenario, a type `A` is defined in an external library and also locally in the source file. Even though the two types have different implementations (they print different strings), they conflict because they share the same fully qualified name. + +First, create a library that defines type `A`: ```csharp // CS0436_a.cs @@ -26,10 +40,8 @@ public class A { } ``` -## Example 2 +Then, compile the following code that defines another type `A` and references the library. The compiler issues CS0436 because both types have the fully qualified name `A` (in the global namespace): - The following example generates CS0436. - ```csharp // CS0436_b.cs // compile with: /reference:CS0436_a.dll @@ -39,7 +51,7 @@ public class A { System.Console.WriteLine("CS0436_b"); } } - + public class Test { public static void Main() @@ -50,8 +62,19 @@ public class Test } ``` -Compilation produces the following output: +When you compile and run this code, the compiler uses the locally defined `A` (from CS0436_b.cs) and issues a warning. The output is: ```console CS0436_b ``` + +Note that the conflict exists even though the two `A` types have different implementations. The difference in the string literal (`"CS0436_a"` versus `"CS0436_b"`) doesn't prevent the conflict. What matters is that both types have the same fully qualified name `A`. + +## How to resolve this warning + +To resolve this warning, you can: + +1. Rename one of the conflicting types. +1. Use a different namespace for one of the types. +1. Remove the reference to the assembly containing the conflicting type if it's not needed. +1. Use an extern alias to disambiguate between the two types if you need to use both (see [CS0433](/dotnet/csharp/language-reference/compiler-messages/cs0433) for examples of using extern aliases). diff --git a/docs/csharp/misc/cs1024.md b/docs/csharp/misc/cs1024.md deleted file mode 100644 index 8ebcdbc86cb3d..0000000000000 --- a/docs/csharp/misc/cs1024.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -description: "Compiler Error CS1024" -title: "Compiler Error CS1024" -ms.date: 07/20/2015 -f1_keywords: - - "CS1024" -helpviewer_keywords: - - "CS1024" -ms.assetid: 41f587cb-1958-4eb6-9f8d-c03500e55e21 ---- -# Compiler Error CS1024 - -Preprocessor directive expected - - A line began with the pound symbol (#), but the subsequent string was not a valid [preprocessor directive](../language-reference/preprocessor-directives.md). - - The following sample generates CS1024: - -```csharp -// CS1024.cs -#import System // CS1024 -``` diff --git a/docs/csharp/misc/cs1025.md b/docs/csharp/misc/cs1025.md deleted file mode 100644 index a3a0cdb1b6786..0000000000000 --- a/docs/csharp/misc/cs1025.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -description: "Compiler Error CS1025" -title: "Compiler Error CS1025" -ms.date: 07/20/2015 -f1_keywords: - - "CS1025" -helpviewer_keywords: - - "CS1025" -ms.assetid: 491c186f-cb40-47a9-9656-44fadfa18ae2 ---- -# Compiler Error CS1025 - -Single-line comment or end-of-line expected - - A line with a [preprocessor directive](../language-reference/preprocessor-directives.md) cannot have a multiline comment. - - The following sample generates CS1025: - -```csharp -#if true /* hello -*/ // CS1025 -#endif // this is a good comment -``` - - CS1025 could also occur if you attempt some invalid preprocessor directive, as follows: - -```csharp -// CS1025.cs -#define a - -class Sample -{ - static void Main() - { - #if a 1 // CS1025, invalid syntax - System.Console.WriteLine("Hello, World!"); - #endif - } -} -``` diff --git a/docs/csharp/misc/cs1027.md b/docs/csharp/misc/cs1027.md deleted file mode 100644 index 813590500c52b..0000000000000 --- a/docs/csharp/misc/cs1027.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: "Compiler Error CS1027" -title: "Compiler Error CS1027" -ms.date: 07/20/2015 -f1_keywords: - - "CS1027" -helpviewer_keywords: - - "CS1027" -ms.assetid: a6657f0f-5664-47a5-95cf-803f5a0e0c90 ---- -# Compiler Error CS1027 - -\#endif directive expected - - A matching `#endif` [preprocessor directive](../language-reference/preprocessor-directives.md#conditional-compilation) was not found for a specified `#if` directive. Or, the compiler may have found a `#endregion` directive when there was no matching `#region` directive inside a `#if` block. - - The following sample generates CS1027: - -```csharp -// CS1027.cs -#if true // CS1027, uncomment next line to resolve -// #endif - -namespace x -{ - public class clx - { - public static void Main() - { - } - } -} -``` diff --git a/docs/csharp/misc/cs1028.md b/docs/csharp/misc/cs1028.md deleted file mode 100644 index 091ca2dc55f10..0000000000000 --- a/docs/csharp/misc/cs1028.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: "Compiler Error CS1028" -title: "Compiler Error CS1028" -ms.date: 07/20/2015 -f1_keywords: - - "CS1028" -helpviewer_keywords: - - "CS1028" -ms.assetid: 9df07db3-256f-45e9-8323-26539c55a1d8 ---- -# Compiler Error CS1028 - -Unexpected preprocessor directive - - A [preprocessor directive](../language-reference/preprocessor-directives.md) was found but not expected. - - For example, a `#endif` was found with no preceding `#if`. - - The following sample generates CS1028: - -```csharp -// CS1028.cs -#endif // CS1028, no matching #if -namespace x -{ - public class clx - { - public static void Main() - { - } - } -} -``` diff --git a/docs/csharp/misc/cs1030.md b/docs/csharp/misc/cs1030.md deleted file mode 100644 index 1db7f8596988c..0000000000000 --- a/docs/csharp/misc/cs1030.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: "Compiler Warning (level 1) CS1030" -title: "Compiler Warning (level 1) CS1030" -ms.date: 08/20/2018 -f1_keywords: - - "CS1030" -helpviewer_keywords: - - "CS1030" -ms.assetid: 7c565abc-1366-4641-9383-ab8ba026ab96 ---- -# Compiler Warning (level 1) CS1030 - -\#warning: 'text' - - Displays the text of a warning defined with the [#warning](../language-reference/preprocessor-directives.md#error-and-warning-information) directive. - - The following sample shows how to create a user-defined warning: - -```csharp -// CS1030.cs -class Sample -{ - static void Main() - { - #warning Let's give a warning here - } -} -``` - -Compilation produces the following output: - -```console -example.cs(6,16): warning CS1030: #warning: 'Let's give a warning here' -``` diff --git a/docs/csharp/misc/cs1032.md b/docs/csharp/misc/cs1032.md deleted file mode 100644 index 5852c43c50242..0000000000000 --- a/docs/csharp/misc/cs1032.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: "Compiler Error CS1032" -title: "Compiler Error CS1032" -ms.date: 07/20/2015 -f1_keywords: - - "CS1032" -helpviewer_keywords: - - "CS1032" -ms.assetid: fe318a6c-4403-4b9b-b3d8-753ec31c00ff ---- -# Compiler Error CS1032 - -Cannot define/undefine preprocessor symbols after first token in file - - The `#define` and `#undef` [preprocessor directives](../language-reference/preprocessor-directives.md#defining-symbols) must be used at the beginning of a program, before any other keywords, such as those used in the namespace declaration. - - The following sample generates CS1032: - -```csharp -// CS1032.cs -namespace x -{ - public class clx - { - #define a // CS1032, put before namespace - public static void Main() - { - } - } -} -``` diff --git a/docs/csharp/misc/cs1038.md b/docs/csharp/misc/cs1038.md deleted file mode 100644 index b7068911b42ce..0000000000000 --- a/docs/csharp/misc/cs1038.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: "Compiler Error CS1038" -title: "Compiler Error CS1038" -ms.date: 07/20/2015 -f1_keywords: - - "CS1038" -helpviewer_keywords: - - "CS1038" -ms.assetid: 05c53ae9-2819-4771-aee8-3f2ff6bcf0b0 ---- -# Compiler Error CS1038 - -\#endregion directive expected - - A [#region](../language-reference/preprocessor-directives.md#defining-regions) directive did not have a matching [#endregion](../language-reference/preprocessor-directives.md#defining-regions) directive. - - The following sample generates CS1038: - -```csharp -// CS1038.cs -#region testing - -public class clx -{ - public static void Main() - { - } -} -// CS1038 -// uncomment the next line to resolve -// #endregion -``` diff --git a/docs/csharp/misc/cs1040.md b/docs/csharp/misc/cs1040.md deleted file mode 100644 index 9090b5c1c9506..0000000000000 --- a/docs/csharp/misc/cs1040.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: "Compiler Error CS1040" -title: "Compiler Error CS1040" -ms.date: 07/20/2015 -f1_keywords: - - "CS1040" -helpviewer_keywords: - - "CS1040" -ms.assetid: a988d665-ead5-489f-922d-ff2c4dd8a922 ---- -# Compiler Error CS1040 - -Preprocessor directives must appear as the first non-white-space character on a line - - A [preprocessor directive](../language-reference/preprocessor-directives.md) was found on a line and was not the first token on the line. A directive must be the first token on the line. - - The following sample generates CS1040: - -```csharp -// CS1040.cs -/* Define a symbol, X */ #define X // CS1040 - -// try the following two lines instead -// /* Define a symbol, X */ -// #define X - -public class MyClass -{ - public static void Main() - { - } -} -``` diff --git a/docs/csharp/misc/cs1517.md b/docs/csharp/misc/cs1517.md deleted file mode 100644 index fcd5549811416..0000000000000 --- a/docs/csharp/misc/cs1517.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -description: "Compiler Error CS1517" -title: "Compiler Error CS1517" -ms.date: 07/20/2015 -f1_keywords: - - "CS1517" -helpviewer_keywords: - - "CS1517" -ms.assetid: 3b0201fb-8fab-4e6a-9ad9-f04c0de89517 ---- -# Compiler Error CS1517 - -Invalid preprocessor expression - - The compiler encountered an invalid preprocessor expression. - - For more information, see [Preprocessor Directives](../language-reference/preprocessor-directives.md). - - The following sample shows some valid and invalid preprocessor expressions: - -```csharp -// CS1517.cs -#if symbol // OK -#endif -#if !symbol // OK -#endif -#if (symbol) // OK -#endif -#if true // OK -#endif -#if false // OK -#endif -#if 1 // CS1517 -#endif -#if ~symbol // CS1517 -#endif -#if * // CS1517 -#endif - -class x -{ - public static void Main() - { - } -} -``` diff --git a/docs/csharp/misc/cs1560.md b/docs/csharp/misc/cs1560.md deleted file mode 100644 index 1840ee0a2a226..0000000000000 --- a/docs/csharp/misc/cs1560.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: "Compiler Error CS1560" -title: "Compiler Error CS1560" -ms.date: 07/20/2015 -f1_keywords: - - "CS1560" -helpviewer_keywords: - - "CS1560" -ms.assetid: 772c4543-6c8d-453f-ae3f-d333528eb8b3 ---- -# Compiler Error CS1560 - -Invalid filename specified for preprocessor directive. Filename is too long or not a valid filename - - The file name that was specified with [#line](../language-reference/preprocessor-directives.md#error-and-warning-information) exceeded _MAX_PATH (256 characters) or the line on which `#line` was found exceeded 2000 characters. - -## Example - - The following sample generates CS1560. - -```csharp -// cs1560.cs -using System; -class MyClass -{ - public static void Main() - { - Console.WriteLine("Normal line #1."); - #line 21 "MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890.txt" // CS1560 - } -} -``` diff --git a/docs/csharp/misc/cs1576.md b/docs/csharp/misc/cs1576.md deleted file mode 100644 index 40f429e803592..0000000000000 --- a/docs/csharp/misc/cs1576.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: "Compiler Error CS1576" -title: "Compiler Error CS1576" -ms.date: 07/20/2015 -f1_keywords: - - "CS1576" -helpviewer_keywords: - - "CS1576" -ms.assetid: 3e39cb80-e7de-4c78-a22a-57e267121a96 ---- -# Compiler Error CS1576 - -The line number specified for #line directive is missing or invalid - - The compiler detected an error with the value passed to the [#line](../language-reference/preprocessor-directives.md#error-and-warning-information) directive. - - The following sample generates CS1576: - -```csharp -// CS1576.cs -public class MyClass -{ - static void Main() - { - #line "abc.sc" // CS1576 - // try the following line instead - //#line 101 "abc.sc" - intt i; // error will be reported on line 101 - } -} -``` diff --git a/docs/csharp/misc/cs1578.md b/docs/csharp/misc/cs1578.md deleted file mode 100644 index 5dd9cfdcf3be1..0000000000000 --- a/docs/csharp/misc/cs1578.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: "Compiler Error CS1578" -title: "Compiler Error CS1578" -ms.date: 07/20/2015 -f1_keywords: - - "CS1578" -helpviewer_keywords: - - "CS1578" -ms.assetid: 8356cd33-5acc-4db7-8bbd-2d25f9d7728e ---- -# Compiler Error CS1578 - -Filename, single-line comment or end-of-line expected - - After a [#line](../language-reference/preprocessor-directives.md#error-and-warning-information) directive, only a file name (in double quotation marks) or a single-line comment is allowed. - - The following sample generates CS1578: - -```csharp -// CS1578.cs -class MyClass -{ - static void Main() - { - #line 101 abc.cs // CS1578 - // try the following line instead - //#line 101 "abc.cs" - intt i; // error will be reported on line 101 - } -} -``` diff --git a/docs/csharp/misc/cs1633.md b/docs/csharp/misc/cs1633.md deleted file mode 100644 index c16397abd25fd..0000000000000 --- a/docs/csharp/misc/cs1633.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -description: "Compiler Warning (level 1) CS1633" -title: "Compiler Warning (level 1) CS1633" -ms.date: 07/20/2015 -f1_keywords: - - "CS1633" -helpviewer_keywords: - - "CS1633" -ms.assetid: f31db218-f880-4fc4-ab34-8bcdc49011da ---- -# Compiler Warning (level 1) CS1633 - -Unrecognized #pragma directive - - The pragma used was not one of the known pragmas supported by the C# compiler. To resolve this error, use only pragmas supported. - - The following sample generates CS1633: - -```csharp -// CS1633.cs -// compile with: /W:1 -#pragma unknown // CS1633 - -class C -{ - public static void Main() - { - } -} -``` diff --git a/docs/csharp/misc/cs1634.md b/docs/csharp/misc/cs1634.md deleted file mode 100644 index a55a1ddf22014..0000000000000 --- a/docs/csharp/misc/cs1634.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: "Compiler Warning (level 1) CS1634" -title: "Compiler Warning (level 1) CS1634" -ms.date: 07/20/2015 -f1_keywords: - - "CS1634" -helpviewer_keywords: - - "CS1634" -ms.assetid: 4fd00eeb-89e3-4c18-827d-9b00a4bd8c9a ---- -# Compiler Warning (level 1) CS1634 - -Expected disable or restore - - This error occurs if a #pragma warning clause is badly formed, such as if disable or restore was omitted. For more information, see the [#pragma warning](../language-reference/preprocessor-directives.md#pragma-warning) topic. - -## Example - - The following sample generates CS1634: - -```csharp -// CS1634.cs -// compile with: /W:1 - -#pragma warning // CS1634 -// Try this instead: -// #pragma warning disable 0219 - -class MyClass -{ - public static void Main() - { - } -} -``` diff --git a/docs/csharp/misc/cs1635.md b/docs/csharp/misc/cs1635.md deleted file mode 100644 index a277214040856..0000000000000 --- a/docs/csharp/misc/cs1635.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: "Compiler Warning (level 1) CS1635" -title: "Compiler Warning (level 1) CS1635" -ms.date: 07/20/2015 -f1_keywords: - - "CS1635" -helpviewer_keywords: - - "CS1635" -ms.assetid: e1795880-f7ea-4dca-b15b-4ba549d7ed78 ---- -# Compiler Warning (level 1) CS1635 - -Cannot restore warning 'warning code' because it was disabled globally - - This warning occurs if you use the **/nowarn** command line option or project setting to disable a warning for the entire compilation unit, but you use `#pragma warning restore` to attempt to restore that warning. To resolve this error, remove the /nowarn command line option or project setting, or remove the `#pragma warning restore` for any warnings you are disabling via the command line or project settings. For more information, see [#pragma warning](../language-reference/preprocessor-directives.md#pragma-warning). - - The following sample generates CS1635: - -```csharp -// CS1635.cs -// compile with: /w:1 /nowarn:162 - -enum MyEnum {one=1,two=2,three=3}; - -class MyClass -{ - public static void Main() - { -#pragma warning disable 162 - - if (MyEnum.three == MyEnum.two) - System.Console.WriteLine("Duplicate"); - -#pragma warning restore 162 - } -} -``` diff --git a/docs/csharp/misc/cs1692.md b/docs/csharp/misc/cs1692.md deleted file mode 100644 index 3ea26f947c4be..0000000000000 --- a/docs/csharp/misc/cs1692.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: "Learn more about: Compiler Warning (level 1) CS1692" -title: "Compiler Warning (level 1) CS1692" -ms.date: 07/20/2015 -f1_keywords: - - "CS1692" -helpviewer_keywords: - - "CS1692" -ms.assetid: 1a6d52e1-0ebb-4990-ac0b-36b05a884a19 ---- - -# Compiler Warning (level 1) CS1692 - -Invalid number - -A number of preprocessor directives, such as `#pragma` and `#line`, use numbers as parameters. One of these numbers is invalid because it is too big, in the wrong format, contains illegal characters, and so on. To correct this error, correct the number. - -## Example - -The following example generates CS1692. - -```csharp -// CS1692.cs - -#pragma warning disable a // CS1692 -// Try this instead: -// #pragma warning disable 1691 - -class A -{ - static void Main() - { - } -} -``` diff --git a/docs/csharp/misc/cs1694.md b/docs/csharp/misc/cs1694.md deleted file mode 100644 index d422c19c1f83a..0000000000000 --- a/docs/csharp/misc/cs1694.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -description: "Learn more about: Compiler Warning (level 1) CS1694" -title: "Compiler Warning (level 1) CS1694" -ms.date: 07/20/2015 -f1_keywords: - - "CS1694" -helpviewer_keywords: - - "CS1694" -ms.assetid: 9cb6b5d4-36a0-4b07-9690-14b5105da44b ---- -# Compiler Warning (level 1) CS1694 - -Invalid filename specified for preprocessor directive. Filename is too long or not a valid filename. - - This warning occurs when using the `#pragma checksum` preprocessor directive. The file name specified is longer than 256 characters. To resolve this warning, use a shorter file name. - -## Example - - The following sample generates CS1694. - -```csharp -// cs1694.cs -#pragma checksum "MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890MyFile1234567890.txt" {00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F} // CS1694 -class MyClass {} -``` diff --git a/docs/csharp/misc/cs1695.md b/docs/csharp/misc/cs1695.md deleted file mode 100644 index f091fb5dfc12d..0000000000000 --- a/docs/csharp/misc/cs1695.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: "Learn more about: Compiler Warning (level 1) CS1695" -title: "Compiler Warning (level 1) CS1695" -ms.date: 07/20/2015 -f1_keywords: - - "CS1695" -helpviewer_keywords: - - "CS1695" -ms.assetid: cc4e4d00-0618-400d-985b-90968e98772c ---- -# Compiler Warning (level 1) CS1695 - -Invalid #pragma checksum syntax; should be #pragma checksum "filename" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" "XXXX..." - - You should rarely encounter this error since the checksum is generally inserted at run time if you are generating code by means of the Code Dom API. - - However, if you were to type in this `#pragma` statement and mistype either the GUID or checksum, you would get this error. The syntax checking by the compiler does not validate that you typed in a correct GUID, but it does check for the right number of digits and delimiters, and that the digits are hexadecimal. Likewise, it verifies that the checksum contains an even number of digits, and that the digits are hexadecimal. - -## Example - - The following example generates CS1695. - -```csharp -// CS1695.cs - -#pragma checksum "12345" // CS1695 - -public class Test -{ - static void Main() - { - } -} -``` diff --git a/docs/csharp/misc/cs1696.md b/docs/csharp/misc/cs1696.md deleted file mode 100644 index a47f40b5ebd26..0000000000000 --- a/docs/csharp/misc/cs1696.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: "Learn more about: Compiler Warning (level 1) CS1696" -title: "Compiler Warning (level 1) CS1696" -ms.date: 07/20/2015 -f1_keywords: - - "CS1696" -helpviewer_keywords: - - "CS1696" -ms.assetid: 69a45988-1aba-4a01-a84e-7ca59f8dde28 ---- -# Compiler Warning (level 1) CS1696 - -Single-line comment or end-of-line expected - - The compiler requires a preprocessor directive to be followed by an end-of-line terminator or by a single-line comment. The compiler has finished processing a valid preprocessor directive, and has encountered something that violates this syntax constraint. - -## Example - - The following sample generates CS1696. - -```csharp -// CS1696.cs -class Test -{ - public static void Main() - { - #pragma warning disable 1030;219 // CS1696 - #pragma warning disable 1030 // OK - } -} -``` diff --git a/docs/csharp/misc/cs1709.md b/docs/csharp/misc/cs1709.md deleted file mode 100644 index 87a9883e39347..0000000000000 --- a/docs/csharp/misc/cs1709.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -description: "Learn more about: Compiler Warning (level 1) CS1709" -title: "Compiler Warning (level 1) CS1709" -ms.date: 07/20/2015 -f1_keywords: - - "CS1709" -helpviewer_keywords: - - "CS1709" -ms.assetid: e2bb1d30-4f30-4e10-82da-df1d3418454c ---- -# Compiler Warning (level 1) CS1709 - -Filename specified for preprocessor directive is empty - - You have specified a preprocessor directive that includes a file name, but that file is empty. To resolve this warning, put the needed content into the file. - -## Example - - The following example generates CS1709. - -```csharp -// CS1709.cs -class Test -{ - static void Main() - { - #pragma checksum "" "{406EA660-64CF-4C82-B6F0-42D48172A799}" "" // CS1709 - } -} -``` diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index ceefdca01b4b5..3259c0f899a1f 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -105,9 +105,6 @@ f1_keywords: - "CS4036" - "CS7002" - "CS7006" - - "CS7009" - - "CS7010" - - "CS7011" - "CS7012" - "CS7013" - "CS7014" @@ -231,8 +228,6 @@ f1_keywords: - "CS8094" - "CS8095" - "CS8096" - - "CS8097" - - "CS8098" - "CS8099" - "CS8100" - "CS8101" @@ -378,7 +373,6 @@ f1_keywords: - "CS8664" - "CS8665" - "CS8666" - - "CS8668" - "CS8669" - "CS8700" - "CS8701" @@ -483,8 +477,6 @@ f1_keywords: - "CS8934" - "CS8935" - "CS8937" - - "CS8938" - - "CS8939" - "CS8940" - "CS8941" - "CS8942" @@ -513,7 +505,6 @@ f1_keywords: - "CS8986" - "CS8987" - "CS8989" - - "CS8996" - "CS8997" - "CS8998" - "CS8999" @@ -541,7 +532,6 @@ f1_keywords: - "CS9025" - "CS9026" - "CS9027" - - "CS9028" - "CS9029" - "CS9030" - "CS9031" @@ -620,10 +610,6 @@ f1_keywords: - "CS9235" - "CS9236" # C# 14 errors begin here -## Shebang - - "CS9297" - - "CS9298" - - "CS9299" ## using `extension` as type name. (valid identifiers). - "CS9306" ## User defined operators @@ -632,10 +618,22 @@ f1_keywords: - "CS9311" - "CS9312" - "CS9313" -## Shebang - - "CS9314" ## Strings in the data section: - "CS9315" +## More extension errors + - "CS9316" + - "CS9317" + - "CS9318" + - "CS9319" + - "CS9326" + - "CS9327" + - "CS9328" + - "CS9329" + - "CS9330" + - "CS9331" + - "CS9332" + - "CS9333" + - "CS9334" helpviewer_keywords: - "errors [C#], additional information" --- diff --git a/docs/csharp/programming-guide/generics/generic-interfaces.md b/docs/csharp/programming-guide/generics/generic-interfaces.md index 107d1f431d582..abc6b79dab2c4 100644 --- a/docs/csharp/programming-guide/generics/generic-interfaces.md +++ b/docs/csharp/programming-guide/generics/generic-interfaces.md @@ -26,7 +26,7 @@ The rules of inheritance that apply to classes also apply to interfaces: :::code language="csharp" source="./snippets/GenericInterfaces.cs" id="Months"::: -Generic interfaces can inherit from non-generic interfaces if the generic interface is covariant, which means it only uses its type parameter as a return value. In the .NET class library, inherits from because only uses `T` in the return value of and in the property getter. +Generic interfaces can inherit from non-generic interfaces. In the .NET class library, inherits from . When a generic interface inherits from a non-generic interface, the type parameter typically replaces `object` in the overridden members. For example, uses `T` in place of `object` in the return value of and in the property getter. Because `T` is used only in output positions in these members, can be marked as covariant. If `T` were used in an input position in an overridden member, the interface couldn't be covariant, and the compiler would generate an error. Concrete classes can implement closed constructed interfaces, as follows: diff --git a/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Test/MakeConst.Test.csproj b/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Test/MakeConst.Test.csproj index 88445e7822658..d5850b7827b53 100644 --- a/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Test/MakeConst.Test.csproj +++ b/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Test/MakeConst.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Vsix/MakeConst.Vsix.csproj b/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Vsix/MakeConst.Vsix.csproj index 7861ef1d1faa1..6b0526b9deb46 100644 --- a/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Vsix/MakeConst.Vsix.csproj +++ b/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Vsix/MakeConst.Vsix.csproj @@ -24,7 +24,7 @@ - + diff --git a/docs/fsharp/language-reference/async-expressions.md b/docs/fsharp/language-reference/async-expressions.md index 7c30adeb431fd..efddc31571a6e 100644 --- a/docs/fsharp/language-reference/async-expressions.md +++ b/docs/fsharp/language-reference/async-expressions.md @@ -17,7 +17,7 @@ async { expression } ## Remarks -In the previous syntax, the computation represented by `expression` is set up to run asynchronously, that is, without blocking the current computation thread when asynchronous sleep operations, I/O, and other asynchronous operations are performed. Asynchronous computations are often started on a background thread while execution continues on the current thread. The type of the expression is `Async<'T>`, where `'T` is the type returned by the expression when the `return` keyword is used. +In the previous syntax, the computation represented by `expression` is set up to run asynchronously, that is, without blocking the current computation thread when asynchronous sleep operations, I/O, and other asynchronous operations are performed. The type of the expression is `Async<'T>`, where `'T` is the type returned by the expression when the `return` keyword is used. The [`Async`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-fsharpasync.html) class provides methods that support several scenarios. The general approach is to create `Async` objects that represent the computation or computations that you want to run asynchronously, and then start these computations by using one of the triggering functions. The triggering you use depends on whether you want to use the current thread, a background thread, or a .NET task object. For example, to start an async computation on the current thread, you can use [`Async.StartImmediate`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-fsharpasync.html#StartImmediate). When you start an async computation from the UI thread, you do not block the main event loop that processes user actions such as keystrokes and mouse activity, so your application remains responsive. diff --git a/docs/fsharp/language-reference/computation-expressions.md b/docs/fsharp/language-reference/computation-expressions.md index 3f55adca0cfb8..75d668b36d595 100644 --- a/docs/fsharp/language-reference/computation-expressions.md +++ b/docs/fsharp/language-reference/computation-expressions.md @@ -80,7 +80,7 @@ If you bind the call to a computation expression with `let`, you will not get th ### `and!` -The `and!` keyword allows you to bind the results of multiple computation expression calls in a performant manner. +The `and!` keyword allows you to bind the results of multiple computation expression calls more efficiently. This keyword enables *applicative computation expressions*, which provide a different computational model from the standard monadic approach. ```fsharp let doThingsAsync url = @@ -92,12 +92,20 @@ let doThingsAsync url = } ``` -Using a series of `let! ... let! ...` forces re-execution of expensive binds, so using `let! ... and! ...` should be used when binding the results of numerous computation expressions. +Using a series of `let! ... let! ...` executes the computations sequentially, even if they are independent. In contrast, `let! ... and! ...` indicates that the computations are independent, allowing applicative combination. This independence allows computation expression authors to: + +- Execute computations more efficiently. +- Can run computations in parallel. +- Accumulate results without unnecessary sequential dependencies. + +The restriction is that computations combined with `and!` cannot depend on the results of previously bound values within the same `let!`/`and!` chain. This trade-off enables the performance benefits. `and!` is defined primarily by the `MergeSources(x1, x2)` member on the builder type. Optionally, `MergeSourcesN(x1, x2 ..., xN)` can be defined to reduce the number of tupling nodes, and `BindN(x1, x2 ..., xN, f)`, or `BindNReturn(x1, x2, ..., xN, f)` can be defined to bind computation expression results efficiently without tupling nodes. +For more information on applicative computation expressions, see [Applicative Computation Expressions in F# 5](../whats-new/fsharp-50.md#applicative-computation-expressions) and [F# RFC FS-1063](https://github.com/fsharp/fslang-design/blob/main/FSharp-5.0/FS-1063-support-letbang-andbang-for-applicative-functors.md). + ### `do!` The `do!` keyword is for calling a computation expression that returns a `unit`-like type (defined by the `Zero` member on the builder): diff --git a/docs/fsharp/language-reference/loops-for-in-expression.md b/docs/fsharp/language-reference/loops-for-in-expression.md index f63126f1001ee..9173bee5c528b 100644 --- a/docs/fsharp/language-reference/loops-for-in-expression.md +++ b/docs/fsharp/language-reference/loops-for-in-expression.md @@ -46,7 +46,7 @@ The output is as follows. 788 ``` -The following example shows how to loop over a sequence, and how to use a tuple pattern instead of a simple variable. +The following example shows how to loop over a sequence, and how to use a tuple pattern instead of a simple variable. In this example, the sequence expression uses the `->` operator, which is a shorthand for `do yield` in sequence expressions and other computation expressions. The `->` operator allows you to specify an expression whose value becomes part of the sequence. For more information, see [Sequences](sequences.md) and [Computation Expressions](computation-expressions.md). [!code-fsharp[Main](~/samples/snippets/fsharp/lang-ref-2/snippet5202.fs)] diff --git a/docs/fsharp/language-reference/xml-documentation.md b/docs/fsharp/language-reference/xml-documentation.md index a48e2301e676c..f9a0587581435 100644 --- a/docs/fsharp/language-reference/xml-documentation.md +++ b/docs/fsharp/language-reference/xml-documentation.md @@ -39,6 +39,9 @@ that immediately follows. Use this method when you want to write only a brief su The comment is encoded to XML during documentation preparation, so characters such as `<`, `>`, and `&` need not be escaped. If you don't specify a summary tag explicitly, you should not specify other tags, such as **param** or **returns** tags. +> [!NOTE] +> When you use comments without XML tags, any markup you include (such as HTML tags or XML-like syntax) will not be parsed or checked by the compiler or F# tooling. Some external tools like GitHub might attempt to parse the markup, but they can fail if the syntax contains errors. If you need to use XML tags in your documentation, wrap your comments with proper XML tags like `` to ensure they're validated by the compiler when `--warnon:3390` is enabled. + The following example shows the alternative method, without XML tags. In this example, the entire text in the comment is considered a summary. [!code-fsharp[Main](~/samples/snippets/fsharp/lang-ref-2/snippet7102.fs)] diff --git a/docs/fsharp/tour.md b/docs/fsharp/tour.md index a831398301397..f3ef9be985077 100644 --- a/docs/fsharp/tour.md +++ b/docs/fsharp/tour.md @@ -49,6 +49,8 @@ You can also create `struct` tuples. These also interoperate fully with C#7/Vis [!code-fsharp[Tuples](~/samples/snippets/fsharp/tour.fs#L205-L218)] +The preceding sample demonstrates using pattern matching to deconstruct tuples in function parameters, such as `(struct(a, b))`, which extracts the individual elements. For more information about pattern matching and deconstructing tuples, see [Tuples](language-reference/tuples.md). + It's important to note that because `struct` tuples are value types, they cannot be implicitly converted to reference tuples, or vice versa. You must explicitly convert between a reference and struct tuple. ## Pipelines diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1005.md b/docs/fundamentals/code-analysis/quality-rules/ca1005.md index 0917340f090a3..9a5a466bf55bb 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1005.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1005.md @@ -10,6 +10,8 @@ helpviewer_keywords: - CA1005 author: gewarren ms.author: gewarren +dev_langs: +- CSharp --- # CA1005: Avoid excessive parameters on generic types @@ -35,6 +37,10 @@ The more type parameters a generic type contains, the more difficult it is to kn To fix a violation of this rule, change the design to use no more than two type parameters. +## Example + +:::code language="csharp" source="snippets/csharp/all-rules/ca1005.cs" id="snippet1"::: + ## When to suppress warnings Do not suppress a warning from this rule unless the design absolutely requires more than two type parameters. Providing generics in a syntax that is easy to understand and use reduces the time that is required to learn and increases the adoption rate of new libraries. diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1700.md b/docs/fundamentals/code-analysis/quality-rules/ca1700.md index f87c858c3aa69..cf40d421715a4 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1700.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1700.md @@ -10,6 +10,8 @@ helpviewer_keywords: - CA1700 author: gewarren ms.author: gewarren +dev_langs: +- CSharp --- # CA1700: Do not name enum values 'Reserved' @@ -43,6 +45,10 @@ In a limited number of cases the addition of a member is a breaking change even To fix a violation of this rule, remove or rename the member. +## Example + +:::code language="csharp" source="snippets/csharp/all-rules/ca1700.cs" id="snippet1"::: + ## When to suppress warnings It is safe to suppress a warning from this rule for a member that is currently used or for libraries that have previously shipped. diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1864.md b/docs/fundamentals/code-analysis/quality-rules/ca1864.md index 1ab8fa91448da..c94db3709c271 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1864.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1864.md @@ -41,7 +41,8 @@ The following code snippet shows a violation of CA1864: ```csharp void Run(IDictionary dictionary) { - if(!dictionary.ContainsKey(2)) { + if (!dictionary.ContainsKey(2)) + { dictionary.Add(2, "Hello World"); } } diff --git a/docs/fundamentals/code-analysis/quality-rules/ca3077.md b/docs/fundamentals/code-analysis/quality-rules/ca3077.md index fb534f7354583..a211b5aad4de2 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca3077.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca3077.md @@ -100,7 +100,7 @@ namespace TestNamespace { public TestClass2() { - XmlResolver = null; + XmlResolver = null; } } } diff --git a/docs/fundamentals/code-analysis/quality-rules/ca5358.md b/docs/fundamentals/code-analysis/quality-rules/ca5358.md index 34c5a2f777317..c77b42a2cf94c 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca5358.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca5358.md @@ -68,8 +68,10 @@ For more information, see [How to suppress code analysis warnings](../suppress-w ```csharp using System.Security.Cryptography; -class ExampleClass { - private static void ExampleMethod () { +class ExampleClass +{ + private static void ExampleMethod() + { RijndaelManaged rijn = new RijndaelManaged { Mode = CipherMode.ECB @@ -98,8 +100,10 @@ class ExampleClass ```csharp using System.Security.Cryptography; -class ExampleClass { - private static void ExampleMethod () { +class ExampleClass +{ + private static void ExampleMethod() + { RijndaelManaged rijn = new RijndaelManaged { Mode = CipherMode.CBC diff --git a/docs/fundamentals/code-analysis/quality-rules/ca5372.md b/docs/fundamentals/code-analysis/quality-rules/ca5372.md index 8f370f0d98c17..e247b7387fc95 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca5372.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca5372.md @@ -65,7 +65,10 @@ The type of the first parameter of `XPathDocument` is not `XmlReader`. using System.IO; using System.Xml.XPath; ... -var obj = new XPathDocument(stream); +public void TestMethod(Stream stream) +{ + var obj = new XPathDocument(stream); +} ``` ### Solution @@ -76,6 +79,6 @@ using System.Xml.XPath; ... public void TestMethod(XmlReader reader) { -var obj = new XPathDocument(reader); + var obj = new XPathDocument(reader); } ``` diff --git a/docs/fundamentals/code-analysis/quality-rules/ca5391.md b/docs/fundamentals/code-analysis/quality-rules/ca5391.md index 62e62a4953948..426814bd196c9 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca5391.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca5391.md @@ -74,14 +74,14 @@ using Microsoft.AspNetCore.Mvc; class ExampleController : Controller { [HttpDelete] - public IActionResult ExampleAction (string actionName) + public IActionResult ExampleAction(string actionName) { return null; } [ValidateAntiForgeryToken] [HttpDelete] - public IActionResult AnotherAction (string actionName) + public IActionResult AnotherAction(string actionName) { return null; } @@ -99,13 +99,13 @@ class ExampleController : Controller { [ValidateAntiForgeryToken] [HttpDelete] - public IActionResult AnotherAction (string actionName) + public IActionResult AnotherAction(string actionName) { return null; } [HttpDelete] - public IActionResult ExampleAction (string actionName) + public IActionResult ExampleAction(string actionName) { return null; } @@ -113,7 +113,7 @@ class ExampleController : Controller class FilterClass : IAsyncAuthorizationFilter { - public Task OnAuthorizationAsync (AuthorizationFilterContext context) + public Task OnAuthorizationAsync(AuthorizationFilterContext context) { return null; } @@ -121,9 +121,9 @@ class FilterClass : IAsyncAuthorizationFilter class BlahClass { - public static void BlahMethod () + public static void BlahMethod() { - FilterCollection filterCollection = new FilterCollection (); + FilterCollection filterCollection = new FilterCollection(); filterCollection.Add(typeof(FilterClass)); } } @@ -138,14 +138,14 @@ class ExampleController : Controller { [ValidateAntiForgeryToken] [HttpDelete] - public IActionResult ExampleAction () + public IActionResult ExampleAction() { return null; } [ValidateAntiForgeryToken] [HttpDelete] - public IActionResult AnotherAction () + public IActionResult AnotherAction() { return null; } diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1005.cs b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1005.cs new file mode 100644 index 0000000000000..26349992056fd --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1005.cs @@ -0,0 +1,22 @@ +namespace ca1005 +{ + // + // This class violates the rule. + public class TooManyTypeParameters + { + public void M1(T t, K k, V v) + { + // ... + } + } + + // This class satisfies the rule. + public class CorrectTypeParameters + { + public void M1(T t, K k) + { + // ... + } + } + // +} diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1700.cs b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1700.cs new file mode 100644 index 0000000000000..3989315053bf6 --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1700.cs @@ -0,0 +1,22 @@ +namespace ca1700 +{ + // + // This enum violates the rule. + public enum BadPaymentStatus + { + Pending = 0, + Completed = 1, + ReservedError = 2, + Reserved = 3, + } + + // This enum satisfies the rule. + public enum GoodPaymentStatus + { + Pending = 0, + Completed = 1, + Error = 2, + Unknown = 3, + } + // +} diff --git a/samples/snippets/core/testing/unit-testing-best-practices/csharp/after/unit-testing-best-practices-after.csproj b/samples/snippets/core/testing/unit-testing-best-practices/csharp/after/unit-testing-best-practices-after.csproj index 43aefd5c2694e..ecd9016971213 100644 --- a/samples/snippets/core/testing/unit-testing-best-practices/csharp/after/unit-testing-best-practices-after.csproj +++ b/samples/snippets/core/testing/unit-testing-best-practices/csharp/after/unit-testing-best-practices-after.csproj @@ -8,9 +8,9 @@ - + - + diff --git a/samples/snippets/core/testing/unit-testing-best-practices/csharp/before/unit-testing-best-practices-before.csproj b/samples/snippets/core/testing/unit-testing-best-practices/csharp/before/unit-testing-best-practices-before.csproj index 43aefd5c2694e..ecd9016971213 100644 --- a/samples/snippets/core/testing/unit-testing-best-practices/csharp/before/unit-testing-best-practices-before.csproj +++ b/samples/snippets/core/testing/unit-testing-best-practices/csharp/before/unit-testing-best-practices-before.csproj @@ -8,9 +8,9 @@ - + - + diff --git a/samples/snippets/core/testing/unit-testing-vb-nunit/vb/PrimeService.Tests/PrimeService.Tests.vbproj b/samples/snippets/core/testing/unit-testing-vb-nunit/vb/PrimeService.Tests/PrimeService.Tests.vbproj index 58c6f5b43a4ce..d3b452420a8b5 100644 --- a/samples/snippets/core/testing/unit-testing-vb-nunit/vb/PrimeService.Tests/PrimeService.Tests.vbproj +++ b/samples/snippets/core/testing/unit-testing-vb-nunit/vb/PrimeService.Tests/PrimeService.Tests.vbproj @@ -8,9 +8,9 @@ - - - + + +