Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I created a new .net framework project just to create line chart since I used .net 7 which did not include chart in it. I successfully created line chart and was able to transfer the line chart from net framework to my project(.net core) but after 1 or 2 successful run or after I made some changes, it removes all the code which only includes the line chart code that I copied.

What I have tried:

I only copied and pasted from .net framework project my notes to my .net 7 project
Updated 20-Jul-23 3:39am
Richard MacCutchan 20-Jul-23 9:02am    
You cannot expect anyone here to guess what the problem is, or even what you mean by, "after I made some changes". Please provide proper details of your problem, including any relevant code.
Ronalyn Ablang 20-Jul-23 11:46am    
Sorry, it's perfectly fine now. The previous nuget package that I installed is maybe not compatible with .net core. I installed new nuget (WinForms.DataVisualization by Microsoft, Kirsan, etc) and it now shows the line chart and can be editable in my .net core project

1 solution

The VS compiler or editor have never shown any tendency to remove code - except occasionally when you remove an Event handler from a control in the designer when it can remove the attached method as well.

I have never seen it remove a whole file or it's content, and am pretty sure that if anyone else had, even Microsoft would have fixed it pretty quickly.
after 1 or 2 successful run or after I made some changes, it removes all the code
At a guess, the changes you made accidentally included removing all the code.

But we can't tell you what to do, or even that it is fixable: it may be that if you still have the same instance of VS open, and the file is still open you may be able to get it back by undoing changes until it reappears - but we have no idea what changes you made of what your code previously looked like.

Can I suggest that you should urgently review your backup procedures and in future ensure that before any major changes are made you ensure a copy of the working code is made, either automatically or manually?
Share this answer
Ronalyn Ablang 20-Jul-23 11:54am    
Thank you for your suggestion, I did copied the necessary codes (the line chart from .net framework) to my notepad.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900