4
votes

I am getting this error pop up box in Visual Studio 2013 Pro version. I get it if i paste something onto a .cshtml page while running the project. Currently I am getting it on an MVC 5 project. I am just wondering it is a bug to Visual Studio 2013 or I just messed up my Visual Studio. My VS is genuine version. I also have 2010, 2012 and 2013 Express installed on my machine.

UPDATE:

I found out it happens when I have Razor syntax in the CSS block.

enter image description here

4
What text are you trying to paste and where exactly in the file are you trying to paste it?greg84
just some CSS. There are Razor, Javascript, CSS, and HTML in the page. Do you need to see the code? I didn't think you needed coz it happens with other pages as well. Sometimes though.Laurence
There used to be an issue with VS opening CSS files with certain content that caused the application to crash. Apparently that's been fixed. Maybe this is a similar issue. Can you add the CSS you're pasting to pastebin or something and include a link to it in your question? Have you tried pasting parts of the CSS in, maybe a few lines at a time? Do you know what character set the file you're copying it from is using? Think that's all the questions I have :)greg84
Thanks mister. well it happens even if i copy one line of CSS from the same file and paste it back somewhere in the file. even if i type something myself, and copy and paste it back, it happens. It is just CSS only though. One interesting thing is when it happens, it doesn't have formatting in CSS. As you can see in the picture, All CSS code is black and no intellisense support.Laurence
I found out it happens when I have Razor syntax in the CSS block.Laurence

4 Answers

4
votes

I had a similar problem. I just restarted visual studio, and then it worked!

0
votes

I have the exact same issue. Everything worked well until i used @Url.Content(...) in element in cshtml. Syntax highlighting also disappeared for the whole element (everything is just black). Removed the lines with @Url.Content(...) and pasting & syntax highlighting worked again in the moment the last line was removed. Also, when i re-paste one @... line, syntax highlighting stops again, pasting shows the error message. Another strange issue: Undo/redo system is stopped. I don't know if this is because of the error above killed it, but it does not work now (even when no @... things are there).

0
votes

It might be related to a code editor, which is being used for the current file. Try right clicking the file in Solution explorer and select Open with and then select the desired code editor. See if that helps, also you may want to make it default one. It helped for me with the same problem but on .cs files.

0
votes

This thread is pretty old, but sharing valuable information is always good. I was facing same issue and solved it accidentally.

Normally i open project from VS recent projects, but accidentally i opened it via solution file(.sln) and copy-paste was started working as expected (i realized this after some-time).