Skip to content
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

Critical Issue with Visual Studio's Rename Functionality Causing Code Corruption #8132

Open
vsfeedback opened this issue Jan 8, 2025 · 2 comments
Assignees

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:Other]
Description:

There is a critical issue in Visual Studio’s rename functionality for Python code. After renaming the function print_exception to print_error using the F2 shortcut, the IDE caused an error in one file where part of the code was incorrectly modified. Specifically, the line:

append_jsonl(best_moments, reels_path)
append_text('\n', reels_path)
except Exception as ex:
    print_exception(ex, False, 'LLM response processing error: ')
    append_text(llm_response + '\n\n', reels_path)
  

was altered to:

print_errorbest_moments, reels_path)
append_text('\n', reels_path)
except Exception as ex:
    print_exception(ex, False, 'LLM response processing error: ')
    append_text(llm_response + '\n\n', reels_path)
  

This issue is highly difficult to reproduce, but its potential consequences are severe. The root cause seems to be related to file caching, code desynchronization, or other inconsistencies between the code and the IDE’s internal state. The primary goal of this ticket is to inform the development team about a critical problem with the rename functionality in Visual Studio that could cause silent failures in the codebase. It is not intended to help me fix the specific instance; I can manually correct the function name, but the issue itself needs to be addressed at the IDE level to prevent further incidents.

Function declaration in one file:
2024-12-26_150529.png
Second file. Function import:
2024-12-26_150633.png
Second file. Successful renaming:
2024-12-26_150700.png
Second file. Malicious renaming:
2024-12-26_150732.png


Original Comments

Vitaliy on 12/26/2024, 07:52 AM:

Please note that " append_jsonl(" which was replaced by "print_error" has the same length as "print_exception", both being 15 characters long.

Feedback Bot on 12/26/2024, 06:04 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

@heejaechang
Copy link
Contributor

can the file with broken changes could have been modified while renaming is going on? did user do anything once invoked the rename?

@Viamo
Copy link

Viamo commented Jan 8, 2025

No, the file wasn't modified either in Visual Studio or externally during renaming. Moreover, the renaming operation took less than a second. Most likely, Visual Studio simply cached outdated variable indexes (desynchronization).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants