I was debugging in the .Net framework source code suddenly when I stepped into a file of theirs, visual studio 2010 raised this error:
File Load:
Some bytes have been replaced with the Unicode substitution character while loading file XXX, Saving the file will not preserve the original file contents.
when I click OK, the file is marked as unsaved, and when I try to save it,开发者_如何学编程 it says that the file is locked, but I can overwrite the file. I don't know what this message means.
And why is now, not the first time when visual studio downloaded the file from the Symbol server?
I started to get this error after switching on (for test purposes) the new setting "Beta: Use Unicode UTF-8 for worldwide language support" in the recent Windows 10 Spring 2018 update.
The message would then appear for every file that has non-ascii characters (German Umlauts mostly in my case) and had not been stored as UTF8 before.
Short-time fix: Revert the setting to not use UTF-8 as the "Current language for non-unicode programs", but use a language with the special characters that are used in the source files.
Long-time fix: Convert all your soure files to UTF-8.
I fixed this issue by changing my "Language for non-Unicode programs" setting to "English (United States)". If you are using Windows 10, you can find it in "Control Panel -> Clock, Language, and Region -> Region -> Administrative".
I've just faced the same problem. It needs to open a file a save it back again. I guess some kinda tool that could do that in a batch will do the trick.
upd: Actually seems that's not helping... Looking for another solution
upd2: Resaving a file actually helps, but you have to disable this option:
Debugging\General\Require source files to exactly match the original version
If you are using Windows 10, you can find it in Control Panel
-> Clock, Language, and Region
-> Region
-> Administrative
. From Language for non-Unicode programs, select "Select system locale"
.
Uncheck box "Beta: Use Unicode UTF-8 for worldwide language support"
. Press ok. You will be prompted to restart windows - do it.
After that if you're developer - you might encounter compile errors in Visual studio like this:
error C2855: command-line option "source-charset" inconsistent with precompiled header
Just rebuild whole project and problem will disappear.
I met the same problem. it seems vs2010 is trying to read the source file using wrong encoding. I open the file with editpad and convert it to utf-8, and it becomes ok.
In my case it was this beta settings that was causing this problem.
well i used notepad++ and edited every file in the project in the end of every file there is NullNullNullNull line remove it and click ctrl+S do this to all files it will help i know it helped me
If you don't want to change your computer encoding setting (as I'm both working on French and Chinese environnement), Here is a way to convert your soure files to UTF-8 encoding using VS Code :
- Open the file with VS Code
- Find the encoding botton at the bottom right (usually says UTF-8)
- Clik on it and selecte reopen wiht encoding, then selecte the first one (automatic recommandation)
- Now you can see the garbled characters gone
- Clik again on the encoding botton and this time selecte save wiht encoding, then selecte UTF-8
- Save file
Hope this helpful.
I'm using the SVN *.tmpl template file for version numbers, and it contains the (c) copyright symbol. VS 2010 complains about this when it generates the AssemblyInfo.cs file from the AssemblyInfo.tmpl file.
So I replaced the copyright symbol with "(c)" and the error message went away.
What worked for me is that I found the page giving error "Some bytes have been replaced with the Unicode substitution character while loading file _PartialLogin.cshtml , Saving the file will not preserve the original file contents."
I opened _PartialLogin.cshtml in a different editor than VS 2017 ( I used Notepad++) click >Encoding< on the menu bar then choose >Encode in UTF-8< then save the file. Its done.
精彩评论