0

Does anyone have any idea what this means in the Watch window, how it was caused and how I could fix it?

I can't seem to find a specific line of code which is breaking it, it appears before the constructor of a class. I don't know what is causing it. I am programming in C# using Visual Studio 2015.

Has anyone else had an issue of this before?

enter image description here

A non-image version of the output is:

此᫈暔熚攺ᙋᲰ耀㼴͹픑㨊攼ᙉᵬ耀 error CS0726: '᫈暔熚攺ᙋᲰ耀㼴͹픑㨊攼ᙉᵬ耀' is not a valid format specifier

I'm not great at languages, but it appears to be a mixture of Chinese, Korean and various unicode characters. All of my code is written in English.

EDIT After further investigation, changing the text value or deleting it will make it not reaper when stepping through the code (Until it hits an exception in my code), or relaunching the debugger.

Sam Bunting
  • 845
  • 1
  • 15
  • 36
  • Do you have any dll reference in your project? – Pikoh Jun 14 '17 at 08:28
  • The references inside of the project contain several assembly references, and several project references. – Sam Bunting Jun 14 '17 at 08:31
  • If you remove the entry from the watch list, can you make it reappear by stepping through your code? – Chris Pickford Jun 14 '17 at 08:34
  • Found something similar here. Try to follow this https://stackoverflow.com/questions/852569/configure-visual-studio-to-show-error-messages-in-english and see if you are able to see actual error in English – Sujith Jun 14 '17 at 08:38
  • 2
    How did this appear - it could be a corrupt VS config file? What happens if you delete it & try to type something sensible. Also - to add to your list of languages you have a couple of Canadian Aboriginal Syllabics in there (the 7th character that looks a bit like a pot on it's side & 15th a pot upside down). – PaulF Jun 14 '17 at 08:51
  • 1
    Also - this is the Watch window - it contains a list of variables you specifically want to watch while debugging. It is not related in any way to a line of code. When you hit a break point, you can enter any value at all in the Name column - if it matches a variable that is currently in scope the value column will show its current value otherwise an error saying it is not in scope. There are various format specifiers that can be used, for example to limit number of array elements - this error is related to that. The names are saved somewhere so they persist when VS is restarted. – PaulF Jun 14 '17 at 09:02
  • 2
    Note - variable names are not automatically added to the watch window - this could have happened accidentally if you cut & paste from somewhere using an unexpected character set. You say it appears before a constructor of a class - does that mean you have hit a breakpoint? – PaulF Jun 14 '17 at 09:06
  • @ChrisPickford Removing it and stepping through the code does not make it reappear. – Sam Bunting Jun 14 '17 at 09:13
  • @PaulF Removing the item and stepping through code does not get it to reappear, changing the Name of the item to "Test String" gives me a value of `error CS0726: 'String' is not a valid format specifier`. The error of the random foreign characters does not appear in debugging after that. – Sam Bunting Jun 14 '17 at 09:17
  • The Name column must be a valid variable name (no spaces) or an expression (spaces allowed but it must be a valid expression) - anything after the valid portion of input may be considered as a format specifier. Check the VS documentation regarding Watch windows & how they work & what is valid for the Name field. – PaulF Jun 14 '17 at 09:28
  • @PaulF Adding a valid character appears to make it work normally. The error I was having before must have been automatically added by Visual Studio while debugging earlier, I barely touch it. – Sam Bunting Jun 14 '17 at 09:31
  • 1
    I have converted my comments to an answer - so you can mark your question as answered for anyone with a similar problem in the future. – PaulF Jun 14 '17 at 12:14

2 Answers2

1

This is the Watch window - it contains a list of variables you specifically want to watch while debugging. It is not related in any way to a line of code. When you hit a break point, you can enter any value at all in the Name column - if it matches a variable that is currently in scope the value column will show its current value otherwise an error saying it is not in scope.

The names are saved somewhere so they persist when VS is restarted, so it is possible it is due to corruption of that file or if you cut & paste from somewhere using an unexpected character set.

The Name column must be a valid variable name (no spaces) or an expression (spaces allowed but it must be a valid expression) - anything after the valid portion of input may be considered as a format specifier (for example to limit number of array elements) - this error is related to that.

You can simply delete this entry & it will be gone permanently. There is no problem with your code.

PaulF
  • 6,673
  • 2
  • 18
  • 29
0

Compiler Error CS0726

Visual Studio 2008 Other Versions 'format specifier' is not a valid format specifier This error occurs in the debugger. When you type a variable name into one of the debugger windows, you can follow it with a comma, and then a format specifier. Examples are: myInt, h or myString,nq. This error arises when the compiler does not recognize the Format Specifiers in C#.

Check your VS language :

  1. On the Tools menu, click Options.
  2. In the Options dialog box, expand Environment and then click International Settings.
  3. In the Language list, choose the language in which the UI text should appear in the development environment.
Abinash
  • 471
  • 3
  • 13