question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class Name Not Updating After Renaming and Copying/Pasting File

See original GitHub issue

Version Used: Visual Studio 2019 16.8 Preview 1

Steps to Reproduce:

  1. Create a new .NET Core Class Library project.
  2. Click Class1.cs file in Solution Explorer and rename to Class2.cs. Should get a prompt to say renaming file. Click Yes and the class Class1 gets renamed to class Class2 in code.
  3. Copy and paste Class2.cs file (I did at same level in solution). Should have the Class2 - Copy. cs at this point.
  4. Double click Class2.cs file to see code. The Class name in code is still class Class1.

Expected Behavior: I believe Class2 - Copy.cs should also be class Class2 since I made a copy of it after changing the name.

Actual Behavior: The copied file contains the Class name before the original file was renamed, copied and pasted.

Hope this helps.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ryzngardcommented, Oct 23, 2020

Perfect, I have a repro now. Thanks!

1reaction
shaggygicommented, Oct 23, 2020

@ryzngard does this help?

ClassNotUpdating

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class Name Not Updating After Renaming and Copying ...
Click Class1.cs file in Solution Explorer and rename to Class2.cs. Should get a prompt to say renaming file. Click Yes and the class...
Read more >
After copying a class and renaming the class-file ...
Now Visual Studio renames the classname (refactor) in both new new copy in folder (zz) and the copied source in folder (xx). This...
Read more >
visual studio - Renaming a class file no longer prompts to ...
1 Answer. Try changing class name, not file name. As 1 file can holds multiple classes. (Don't know if this is true for...
Read more >
Copy and Paste after changing file names
Hello, I am having some problems with copying and pasting files. I was trying to copy a file and then change the name...
Read more >
The nightmare that is renaming a class and its folder - LAVA
Renaming a class from LabVIEW, no problem, F2 works wonders. But now it's contained on disk in a folder that most likely has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found