Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

No description provided.

Copilot AI and others added 30 commits November 12, 2025 21:17
…1178)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: Cyrus Najmabadi <cyrus.najmabadi@gmail.com>
[main] Update dependencies from dotnet/arcade
[main] Source code updates from dotnet/dotnet
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: Jan Jones <jan.jones.cz@gmail.com>
…pe (dotnet#80760)

Fix superfluous managed address errors for pointer to non-existent type

## Summary
Fixed issue dotnet#38378 where
declaring a pointer to a non-existent type would report both CS0246
(type not found) and CS8500/CS0208 (managed address warning/error). Now
only CS0246 is reported.

## Changes Made
- [x] **Binder_Expressions.cs**: Added error type check in
`CheckManagedAddr()` to skip the warning only for truly missing types
(LookupResultKind.Empty or NotATypeOrNamespace), but still report for
other error scenarios like inaccessible types
- [x] **Binder_Symbols.cs**: Removed redundant check (now handled in
CheckManagedAddr)
- [x] **ConstraintsHelper.cs**: Removed redundant check (now handled in
CheckManagedAddr)
- [x] Added 4 comprehensive test cases in UnsafeTests.cs using raw
string literals with C# pointer style (Type* instead of Type *)
- [x] Updated 2 existing tests (PointerTypeInDeconstruction,
TypeNamedFile_03_CSharp11) to reflect new behavior for error types from
parse errors

## Test Results
- ✅ All 4 originally failing tests now pass
- ✅ All 4 new test cases pass
- ✅ All 491 unsafe tests pass

## Fix Pattern
Centralized the check in `CheckManagedAddr` with refined logic: skip
warning only for types that are truly missing
(Empty/NotATypeOrNamespace), but still report for other error scenarios
(e.g., Inaccessible types). Uses modern C# pattern matching syntax for
clean code.

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Quality of implementation: superfluous errors for pointer
to non-existent type</issue_title>
> <issue_description>Compile the following program:
> 
> ```cs
> class Program
> {
>     static unsafe void Type(Type *type)
>     {
>     }
> }
> ```
> 
> # Expected
> > Program.cs(3,29): error CS0246: The type or namespace name 'Type'
could not be found (are you missing a using directive or an assembly
reference?) [/Users/hugh/Documents/GitHub/repo/repo.csproj]
>  
> A single error that we can't find the type
> 
> # Actual
> > Program.cs(3,29): error CS0246: The type or namespace name 'Type'
could not be found (are you missing a using directive or an assembly
reference?) [/Users/hugh/Documents/GitHub/repo/repo.csproj]
> Program.cs(3,29): error CS0208: Cannot take the address of, get the
size of, or declare a pointer to a managed type ('Type')
[/Users/hugh/Documents/GitHub/repo/repo.csproj]
> 
> The second error is pointless in this case as the type doesn't exist.
I would suggest not checking if we can take the address, size or declare
a pointer to a non-existent type</issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> <comment_new><author>@RikkiGibson</author><body>
> Currently we refrain from giving the ManagedAddr error (CS0208) for
sizeof and stackalloc array creation when the type is an error type. It
seems like we don't need to give the error in this case (pointer to an
error type) either.</body></comment_new>
> </comments>
> 


</details>

Fixes dotnet#38378

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: Cyrus Najmabadi <cyrus.najmabadi@gmail.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
…ining list patterns

Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
…net#81209)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: Cyrus Najmabadi <cyrus.najmabadi@gmail.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
- Added IsCommaInTupleType helper method to FormattingHelpers.cs
- Added IsCommaInParenthesizedVariableDesignation helper method for deconstruction
- Updated SpacingFormattingRule to check tuple commas for spacing options
- Added comprehensive tests for tuple expression, type, nested tuples, and deconstruction formatting

Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Updated FormatListPattern_Parentheses test to correctly expect tuple type formatting to respect SpaceAfterComma and SpaceBeforeComma options. This aligns with the intended behavior where these options should apply to all comma-separated contexts including tuples.

Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Added [WorkItem("dotnet#32207")] attribute to all 6 new test methods as requested in PR feedback.

Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Removed XML documentation comments from IsCommaInTupleType and IsCommaInParenthesizedVariableDesignation as the method names are self-explanatory, consistent with similar methods in the file.

Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Fixed line 297 where it incorrectly checked previousToken instead of currentToken for IsCommaInCollectionExpression in the "before comma" section.

Extracted duplicate comma checking logic into IsCommaWithCustomSpacing local function to eliminate code duplication between "after comma" and "before comma" sections.

Added test CollectionExpression_SpaceBeforeComma to demonstrate the fix works correctly.

Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
CyrusNajmabadi and others added 19 commits November 20, 2025 21:45
[main] Update dependencies from dotnet/arcade
[main] Source code updates from dotnet/dotnet
Fixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/2641964.

StringTokenMap (added in dotnet#78033)
used reference equality comparer; I believe by mistake; which
made it possible for it to contain the same string multiple times;
leading to overflowing the user string heap limit sooner than before.
…sibility of declared extension method (dotnet#81378)

Due to an oversight it was compared to accessibility of extension block
container, which is always `public`.

Fixes dotnet#81180

Relates to test plan dotnet#76130
[main] Update dependencies from dotnet/arcade
[main] Update dependencies from dotnet/arcade
I am proposing fixes for two LSP conformance issues I discovered while
integrating Roslyn LSP with Zed:

1. The response from the `textDocument/diagnostic` request cannot be
`null`. MS.CA.LanguageServer currently returns a `null` response in the
case described here:
https://github.com/dotnet/roslyn/blob/76a39c1a97fe5c73549786fc6944dc188a7b7b3b/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSourceProviders/DiagnosticSourceManager.cs#L72-L80
Because the set of diagnostic handlers is empty, a response value is
never generated for the request, and we fall through to returning
`null`. Instead, explicitly return an empty list of diagnostics. (This
is exactly how VS Code's LSP client treats a `null` response.)

2. Methods that take no parameters (e.g. `workspace/diagnostic/refresh`)
were being sent with an empty array as the parameter value. This is
because the `InvokeWithCancellationAsync` method in StreamJsonRpc
normalizes unspecified arguments to an empty list. Use the
`InvokeParameterObjectAsync` method instead, which don't do this.
@CyrusNajmabadi CyrusNajmabadi requested review from a team as code owners November 24, 2025 19:18
@CyrusNajmabadi CyrusNajmabadi changed the title Fix indentation of if statement after else on separate line (#81178) Merge 'main' into 'features/collection-expression-arguments' Nov 24, 2025
@CyrusNajmabadi CyrusNajmabadi merged commit 5640152 into dotnet:features/collection-expression-arguments Nov 25, 2025
29 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the mergeMainForReal branch November 25, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.