How to fix VS Code error while loading images? - windows

Any time I try to use an image from my local machine, I get an error from VS Code saying "An error occurred while loading the image. Open file using vs code's standard text/binary editor."
The original drag and drop of the image into the file functions as in I can see the image in the text editor but if I click onto another file/folder and back onto the image file, I get this error. This is happening in this instance while trying to use a .ico file but it has been happening for about a week now with any image I try to use (.png, .ico, .jpg, etc...). I am on a Windows 10 machine and memory is not an issue.
I have tried disabling all extensions, replacing the file with another, making sure VS Code is up to date and completely closing VS Code and re-opening it.

Alright, I got the same issue last week, and this was how I fixed it:
Go to where you saved the project on your laptop, then drag and drop the images there. This should reflect in your VS Code.
Once the images were added through this route, they would not bring the initial error.
Let me know if you got what I said or if a short video will help!

Related

Inconsistent length calculation in projection snapshot

In Visual Studio 2017 something unexpected happened when I was working. I was editing razor view (nothing special, just normal editing - I've copy pasted small chunk of text) and all the sudden I've got this message:
I've tried to restart visual studio, delete suo file, delete my temporary folder... now I can not work inside this particular view. If I try to change anything in this .cshtml I got message above or this message:
What is this? I don't recall seeing this in previous versions of visual studio. How to avoid this and proceed with work?
I got this in VS 2019 and just needed to restart VS.
I found an issue and they claim the issue was fixed in the new version. So I updated, but the issue still occurred, maybe because it was triggered in the old version.
Clean/rebuild didn't work. What I ended up doing after updating (I don't know if all steps are necessary, but this worked for me):
Copy the contents of the old file (make edits if necessary, I didn't
have valid .cshtml at the time and I didn't want to run into the same error again)
Created a new file and paste the contents in there
Delete the old file
Commit code
Rename old file to new name
Commit code again
Then it was solved
I too ran in to this today with Visual Studio 2019. The editor was showing a bunch of what looked like metadata inserted in the middle of the file. The garbage text even ended up getting checked in to my repo when I didn't notice it.
Any attempt to "fix" (i.e. delete) the garbage data would result in the OP's errors or other strange errors. Closing VS and reloading didn't help.
What finally did work though was to copy the file contents (which oddly enough didn't include the garbage data when copied to the clipboard from VS) to a new file in Notepad++, then close VS, save the file from Notepad++ over the top of the original file, then reload the project. After that everything was fine.
It seems like something goes haywire and it gets it's buffers crossed or something. Once it happens, VS is unable to deal with the file any more and the only alternative seems to be editing it outside of VS.

VS2010 Designer is breaking resx files

If anyone have any clue at all, it would be welcome. I got the same problem last year, and we end up ghosting my computer. 9 month later, I got the problem again ...
Whenever I open a project, if I open a form in my designer, the resx files get automaticly checked-out and modified as I open it.
( we have an auto-check out policy at work that force you to check out a file WHEN YOU MODIFY IT, to avoid 2 programmer working on the same stuff. its not support to check out when I'm just "reading" a file. I just compared with other poeple, and it works correctly for everyone but me.)
The above image is what I saw when I debug the program, I didnt checked-in anything. I just did a getlatest, and debugged.
Whenever I open a form, The width property of the form gets overwritted down to 770 pixel instead of the regular 950. the image data used on our button gets resize smaller too by ±10 pixel width and height.
Another exemple : this is what I saw when I compared my last resx file checked in from last night. I didnt modified the design or moved anything in the designer at all, it just happened to be open while I was working.
remove the .suo file?
while the solution is closed remove the .suo file and then open the solution to recreate it. it may be restoring the screen sizes from when you last opened the file.
Old bug date from vs2003 ...
my screen DPI wasnt the same as the guy who 1st build the winform ... which cause the desginer to replace all the anchors et fonts et whatnot ...
check out this post for more details : DPI

running website locally wont updates images

So im making a website on Visual Studio 2013. I have a folder of images with images inside. It used to be another image but I changed my name so i overwritten the image with the new one.
The html is right, however when i run it it still shows the old image.
I thought maybe it hasnt updated or didnt overwrite so ive been adding it over and that didnt work. I also tried deleting it altogether and then adding it fresh and that didnt work.
Then I thought maybe the file path is wrong - no. definately right.
What should I do? Every time i run it, it showing the old image even though it doesnt exist anymore.
A hard refresh was the answer for me, as Max said, typically Ctrl + F5. for me it was Fn F5

Export Visual Studio Template error: "Unable to read an exported file"

When exporting a Visual Studio project to a Template (File/Export Template...) I get the following error upon clicking the Finish button:
Unable to read an exported file for the following
reason: The file cannot be opened with the selected
editor. Please choose another editor.
Screenshot http://img687.yfrog.com/img687/1756/templateerror.png
A Google search for this error has only led to several dead ends. There aren't any unusual file types in this project. Any ideas what could be going on?
By laborious trial and error (start with an empty project, add a folder, try to export template) I was able to narrow this down to a single Javascript file. As it happens, it's one of the language definitions for prettify.js (which is used on this site for code coloring). The file in question is lang-hs.js, and for some reason Windows on my machine treats this file differently from other Javascript files: It opens in Notepad, when I have the .js extension mapped to Visual Studio.
I'm not sure what the underlying explanation is, but I've already wasted enough time on this and I believe I can live without Haskell code coloring (!) so I'm just deleting this file and moving on.
It seems ".cur" files are often a culprit in this error. I have removed them from my project and now the exportation works correctly.
Microsoft staff suggest looking at log files (../windows/system32/compmgmt.msc) but this error does not spawn an entry into the Application EventLog.

png files are not showing

HI,
All of a sudden today png files of my web application are not showing up in the browser.
I am using Visual Studio 2008. The files are not even opening in the vs editor.
When i double click on the icons in the vs editor it is saying
"Cannot load file. Unknown bitmap format." But so many days those were there and was working
fine. So all of a sudden what happens them to not work?
Anybody has any suggestion?
Thanks & Regard,
Subrat.
It might be that they are not actually .PNG format under the hood, but were merely named that way. Some browsers will work around this and some will not. Try renaming them to .jpg, .bmp, .gif, etc., and for each test, change your <img> and see if it works in every browser. When it does, you've found the right format.
An alternative is to open your file in a paint program and convert to PNG format (not merely PNG file extension) as you save. Then you can be sure the format is correct.

Resources