Visual Studio C Syntax Coloring issue - c

I used to work with Eclipse for my C firmware for a STM32-based board, and now I'm switching to Visual Studio 2017 + VisualGDB.
The project is working, but there's something strange for the syntax highlighting and coloring.
Pictures to understand better:
Highlighting totally lost [I placed the cursor in the variable "timer"]
Syntax Coloring when the file is saved [No colors]
Syntax Coloring when editing the file [OK!]
If I edit the file and press Ctrl+S, the Colors go away!
I already reset the editor colors to default in Options, repaired the VS installation and rebooted PC, etc.
In other C++ and C# projects, everything is fine.

Well, setting Options > VisualGDB > General > Enable Clang Intellisense by Default to False solved it.
Until now didn't see what I've lost by disabling it, but at least the colors and the selections are back to normal!
Thanks for the help!

Related

How do I fix DPI scaling issues for Visual Studio 2017 Windows Forms

I've been encountering this issue ever since I bought this laptop with 4k display in 2015. With a lot of effort I managed to work around the issue but I'm growing tired of it.
VS2017 is supposedly DPI aware hence I do not expect any issues when creating a simple MDI Parent Form and running the app. But to my frustration the icons in the toolStrip (just the standard one in the MDI parent form) are scaled horribly.
When I create a form with a button on it which looks just fine in Visual Studio 2017 designer and I run the app and load the form, the button text isn't completely shown.
My display settings are as follows:
Resolution: 3840x2160
Scaled 250% (in display settings) because at 100% everything is unreadable
I've tried to find solutions, but the only workable thing I could find was setting my visual studio designer to dpi-unaware via registry (link here)
Help anyone?
Update When I add a new MDI form with the setting of DPI-awareness OFF, everything looks OK except Visual Studio itself (blurry).
I have similar problem when working with Windows Forms (Windows Forms Designer) on Visual Studio 2017, but I think it would be the same on Visual Studio 2019.
From Microsoft documentation here, there is a tip to disable the scaling/DPI aware feature.
If you prefer to manage settings from the command line, devenv.exe
takes /noscale as a command-line parameter to run in 100% scaling
mode.
So, basically, I just created a shortcut on the Desktop to Visual Studio (devenv.exe) and added the parameter /noscale on the shortcut Target field like so:
"...\path\to\IDE\devenv.exe" /noscale
So, everytime Visual Studio is started through the shortcut, it will always start with 100% scaling mode. If you use high resolution screen (high-dpi) screen, you will notice that the Visual Studio text will appear a little bit blurry because of this.
You should change the settings so there won't be a difference when the program runs on different machines.
Go to the project's properties page, then to Manifest Tool and then Input and Output. Change the DPI awareness to 'none'

XAML syntax highlighting missing

After a clean installation of Visual Studio 2015 Enterprise, on a brand new Surface Pro 4 running Windows 10, my XAML syntax highlighting is missing. I've got XAML syntax highlighting on 3 other computers that run Windows and Visual Studio; this machine for some reason doesn't have it.
I tried resetting the user data in Visual Studio and I noticed this prior to installing any extensions. It seems like I'm not the only one to have this issue. What steps need to be performed in order for my syntax highlighing to return? The Intellisense seems to work without issue, just the highlighting is missing.
Note that I've also tried resetting the environment fonts & colors back to defaults; didn't fix the issue. My C# and Sql syntax highlighting work without any problems.
I had the same problem. Additionally I remarked the XAML items were missing from the Fonts and Colors section of Visual Studio settings.
After I ran devenv /Setup from an elevated command prompt, the XAML items were back in the settings and I could see colors in the XAML editor.
I my case the problem was fixed by switching to different color scheme and then back to the one I use.

Visual studio 2012 XAML designer invalid markup

I've got a project that contains usercontrols. For some reason, the design view for the window which uses the said controls has stopped functioning and insists on "Invalid Markup" - the error given is that some members of the usercontrols are not recognized or not accessible. The project however compiles and executes just fine. Loading it up in VS2010, the editor works fine, no errors whatsoever - the same even in Expression Blend.
So far I have tried the typical clean, rebuild, manually deleting stuff from obj, updating the .xaml and rebuilding, tried starting VS2012 with /resetuserdata and /resetsettings - the problem persists. I even rolled back to a much older revision of my project, back when the designer was working just fine, no dice - same error. I also tried launching VS2012 as a new windows user to avoid any stored appdata that might be lingering, again a no go.
Is there some other sort of cache or something that I could manually delete?
There's also an issue with the ShadowCache (used for rendering designer) getting out of sync with your XAML in VS2012. I just found this out, as I was having a horrible time with the following error with derived user controls:
The local property XXXX can only be applied to types that are derived from YYYYY.
The shadow cache is located in your user profile directory:
app data\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache
You can delete everything in there and restart VS2012. After that, things worked much better (for at least a while!)
Delete everything in ShadowCache
C:\Users\username\AppData\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache\
Copy-pasteable paths
Just copy/paste one of these paths into Windows Explorer. %LOCALAPPDATA% is a Windows Environment Variable it will be replaced with the corresponding value when entered into Explorer (also works in Command Prompt)
VS2012
%LOCALAPPDATA%\Microsoft\VisualStudio\11.0\Designer\ShadowCache\
VS2013
%LOCALAPPDATA%\Microsoft\VisualStudio\12.0\Designer\ShadowCache\
VS2015
%LOCALAPPDATA%\Microsoft\VisualStudio\14.0\Designer\ShadowCache\
ASP.NET
If you develop ASP.NET also delete
%LOCALAPPDATA%\Microsoft\WebsiteCache
%LOCALAPPDATA%\Temp\VWDWebCache
I'm not sure this will fix all cases but this is what worked for me (all the time now).
I have VS2012, using the Blend designer in the IDE, building an x64 application, when I would define a new ICommand and add the Command attribute, I would get the designer isn't supported in x64 error (I forget the exact warning). If I switch to x86, I'd get invalid XAML markup errors complaining the the ICommand wasn't recognized or was not accessible, no matter how many times I rebuilt in x64. If I switch to x86, build, then switch back to x64, voila, not problems with the designer.
Now I recall similar issues with VS2008 and Blend version 3 and 4. From what I've read in other posts, using Any CPU might also resolve the issue.
May be you have added user controls which are not supported or you might have added some wrong parent-child relationship in your user controls . Try removing the suspected User Controls and rebuilding the project . It must fix the issue .
Cheers
You need to re:encode your xaml, open bugged files in ide -> save as -> save encoded (choose UTF8)
I've the same problem while using controls with a custom (no param) Constructor.
Check if the Custom/User Control constructor doesn't require any data that the WPF designer doesn't have. A quick wait to check that is surrounding the whole thing with a try catch, cleaning, rebuilding and then check to see if the problem is solver.
If it is not, try commenting everything except the default WPF Init cod, clean, rebuild and test it out.
In Visual Studio 2013 this is a workaround I using for my Windows Phone Project, http://danielhindrikes.se/visual-studio/workaround-for-invalid-markup-problems-when-developing-for-windows-phone/. I guess it is the same designer that is used when you writing XAML for WPF.
Have tried to delete Shadow Cache but itjust work first time I start Visual Studio, above workaround is the only thing that helped me.
A little late, but something else to consider: If your no-parameter constructor is doing some other work, like getting data that doesn't exist because you are in the designer, add this at the start of your constructor:
if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) return;
// Do work.
This is necessary because the designer does execute your no-parameter constructor which may fail in design mode an give you the invalid markup.
And, regardless of what others are saying, this is not a VS or WPF XAML Parser bug. I ran into this issue today using VS 2015, .Net 4.5.2.
I just had the same problem (program compiling and running fine, XAML designer reporting invalid markup), the issue was that I had accidentally changed the assembly name of one of the projects in my solution, I changed it back and my XAML designer sprang back to life, so check the Properties page of each project in your solution, and ensure the Assembly Name is as you expect it to be.
I think there is no problem in your project, but it is problem in VS 2012. Try to install the latest update for VS 2012 (Update 2) and also check this answer.
Regards,
I have the same Problem with VS 2015 and 2017 but only if I compile for x64 only.
Here it helps if I change compile target (Project properties - Build, its called Plattformziel in german) temporarily to x86, compile to project and switch back to x64.
Maybe this is a "solution" for anybody else.

WPF designer not showing anymore

I have a very strange problem with my Visual Studio 2010 SP1 installation on a 64 bit system.
When I double click a xaml file in the solution explorer, nothing happens. The Designer doesn't show. However, when I CTRL + Tab, the file appears in the "Active Files" list.
Anyone has encountered this before? Is this a know bug? I couldn't find anything on the net...
I would check that the designer isnt simply being hidden away. Try (Menu) View > Designer or Shift+F7
Right click the xaml file, select Open With.... Which is the default editor? It should be Windows Presentation Foundation Designer.
Just to finish this question:
After some weeks it started working again. Never found out why or why it stopped working...

WPF Control files are opening as Text Files on Visual Studio 2008

Though other types of files open fine and Auto completion is working, but Usercontrol(XAML files) appear as plain text with no syntax highlighting.
I went to the Text Editor section under Tools->Options and, whenever I tried to bring up the Formatting options for XAML, it says an error occurred.
It was working fine, but I had to uninstall/reinstall VS 2008 for some other issue and it's not working now.
Have you tried using "devenv /resetsettings" or "devenv /ResetSkipPkgs" ?
I remember having similar issue a long time ago, and was able to fix it by using some command-line reset of the IDE.

Resources