Skip to content

null error when renaming a variable #60592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
numberbee7070 opened this issue Apr 22, 2025 · 6 comments
Closed

null error when renaming a variable #60592

numberbee7070 opened this issue Apr 22, 2025 · 6 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. devexp-server Issues related to some aspect of the analysis server P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@numberbee7070
Copy link

If this is a bug report, please help us by providing:

  • a clear description of the problem you are experiencing
    • Unable to rename a variable in VS code. Attached output error log of LSP
  • the expected and actual behavior, including a repro with the specific code triggering the issue
    • Can not share the source code that caused it
  • the Dart SDK version (dart --version)
    • Dart SDK version: 3.7.0 (stable) (Wed Feb 5 04:53:58 2025 -0800) on "linux_x64"

The more information you can provide, the better we can understand and address the issue. Thanks!

[Error - 00:29:18] Request textDocument/rename failed.
  Message: An error occurred while handling textDocument/rename request
  Code: -32001 
[Error - 00:29:18] An error occurred while handling textDocument/rename request: Null check operator used on a null value
#0      RenameProcessor.addDeclarationEdit2 (package:analysis_server/src/services/refactoring/legacy/rename.dart:51:68)
#1      RenameParameterRefactoringImpl.fillChange (package:analysis_server/src/services/refactoring/legacy/rename_parameter.dart:83:19)
#2      RenameRefactoringImpl.createChange (package:analysis_server/src/services/refactoring/legacy/rename.dart:173:11)
#3      RenameHandler.handle.<anonymous closure> (package:analysis_server/src/lsp/handlers/handler_rename.dart:256:38)
<asynchronous suspension>
#4      ErrorOrRecord4Extension.mapResults (package:analysis_server/src/lsp/error_or.dart:217:12)
<asynchronous suspension>
#5      ServerStateMessageHandler.handleMessage (package:analysis_server/src/lsp/handlers/handlers.dart:508:20)
<asynchronous suspension>
#6      LspAnalysisServer._handleRequestMessage (package:analysis_server/src/lsp/lsp_analysis_server.dart:1147:18)
<asynchronous suspension>
#7      LspAnalysisServer.handleMessage.<anonymous closure>.<anonymous closure> (package:analysis_server/src/lsp/lsp_analysis_server.dart:535:15)
<asynchronous suspension>
#8      OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#9      LspAnalysisServer.handleMessage.<anonymous closure> (package:analysis_server/src/lsp/lsp_analysis_server.dart:514:11)
<asynchronous suspension>
@numberbee7070 numberbee7070 added the area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. label Apr 22, 2025
@bwilkerson bwilkerson added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Apr 22, 2025
@mrcsh
Copy link

mrcsh commented Apr 26, 2025

I have seen this issue come and go on android studio for a while now, I think before I upgraded to flutter 3.29.
For me the failures seems to happen more (possibly exclusively??) on renaming closure parameters rather than formal function parameters or class fields.

@FMorschel
Copy link
Contributor

Hey guys! If that is the error than it has already been fixed at #60047.

@mrcsh
Copy link

mrcsh commented Apr 26, 2025

Oh good, hopefully the fix will be released soon.

@FMorschel
Copy link
Contributor

This is the commit: 1a0b1fe. If you open it on your browser (the GH mobile app doesn't show the tags last time I checked) it will show that this will release on Dart >= 3.8.

@srawlins srawlins added devexp-server Issues related to some aspect of the analysis server P2 A bug or feature request we're likely to work on crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. labels Apr 28, 2025
@FMorschel
Copy link
Contributor

As noted above I think this has already been solved @srawlins we may close this. Can you confirm?

@srawlins
Copy link
Member

srawlins commented May 5, 2025

Confirmed, thanks for catching, @FMorschel !

@srawlins srawlins closed this as completed May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. devexp-server Issues related to some aspect of the analysis server P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants