Skip to content

Comments

[TINY] Use InterceptableLocation for precompiled query interceptor generation#37734

Merged
roji merged 3 commits intomainfrom
copilot/fix-intercepted-methods-attribute
Feb 20, 2026
Merged

[TINY] Use InterceptableLocation for precompiled query interceptor generation#37734
roji merged 3 commits intomainfrom
copilot/fix-intercepted-methods-attribute

Conversation

Copy link
Contributor

Copilot AI commented Feb 18, 2026

  • Replace InterceptsLocationAttribute(string filePath, int line, int column) with InterceptableLocation-based generation in PrecompiledQueryCodeGenerator.cs
    • Change the [InterceptsLocation(...)] attribute generation in GenerateOperatorInterceptor to use semanticModel.GetInterceptableLocation() and GetInterceptsLocationAttributeSyntax()
    • Change the attribute declaration at the bottom of the generated file from InterceptsLocationAttribute(string filePath, int line, int column) to InterceptsLocationAttribute(int version, string data)
  • Move error message string to DesignStrings string resource
  • Build and verify the changes compile
  • Run precompiled query tests to verify (125 passed, 4 skipped)
  • Run security checks (CodeQL clean)
Original prompt

This section details on the original issue you should resolve

<issue_title>Precompiled queries: use InterceptableLocation rather than InterceptsLocationAttribute when creating interceptors for operations in precompiled queries</issue_title>
<issue_description>Currently we decorate intercepted operator methods with InterceptsLocationAttribute(string filePath, int line, int column)

This issues a warning: 'InterceptsLocationAttribute(string, int, int)' is not supported. Move to 'InterceptableLocation'-based generation of these attributes instead. (dotnet/roslyn#72133)
</issue_description>

Comments on the Issue (you are @copilot in this section)

@roji @jonkelling I'm not sure - will take a look at this at some point, and possibly patch 10.0 for it; in the meantime refrain from using precompiled queries.

💡 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 in the docs.

…ionAttribute(filePath, line, column) for precompiled query interceptors

Co-authored-by: roji <1862641+roji@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix use of InterceptableLocation in precompiled queries Use InterceptableLocation for precompiled query interceptor generation Feb 18, 2026
Copilot AI requested a review from roji February 18, 2026 11:51
@roji roji marked this pull request as ready for review February 18, 2026 13:57
Copilot AI review requested due to automatic review settings February 18, 2026 13:57
@roji roji requested a review from a team as a code owner February 18, 2026 13:57
@roji roji enabled auto-merge (squash) February 18, 2026 13:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the precompiled query code generator to use the new Roslyn InterceptableLocation API instead of the deprecated InterceptsLocationAttribute(string, int, int) constructor, which was producing warnings directing users to the new API (roslyn#72133).

Changes:

  • Updated the file-scoped InterceptsLocationAttribute constructor signature from (string filePath, int line, int column) to (int version, string data) to match the new format
  • Replaced manual line/column computation with semanticModel.GetInterceptableLocation() and GetInterceptsLocationAttributeSyntax() API calls

@roji roji assigned AndriySvyryd and unassigned roji Feb 18, 2026
@roji roji changed the title Use InterceptableLocation for precompiled query interceptor generation [TINY] Use InterceptableLocation for precompiled query interceptor generation Feb 19, 2026
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI requested a review from AndriySvyryd February 20, 2026 00:58
@roji roji enabled auto-merge (squash) February 20, 2026 06:49
@roji roji disabled auto-merge February 20, 2026 08:12
@roji roji merged commit f74c457 into main Feb 20, 2026
10 of 11 checks passed
@roji roji deleted the copilot/fix-intercepted-methods-attribute branch February 20, 2026 08:13
Copilot AI added a commit that referenced this pull request Feb 20, 2026
…nterceptor generation

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Precompiled queries: use InterceptableLocation rather than InterceptsLocationAttribute when creating interceptors for operations in precompiled queries

3 participants