Visual Studio發現它出現「語法錯誤」與「編譯器錯誤」之間的區別是什麼?或者換一種說法,爲什麼一些「編譯時」錯誤用紅色波浪線和一些用藍色波浪線表示?這裏有一個例子:Visual Studio中的語法錯誤與編譯器錯誤或紅色波浪下劃線與藍色波浪下劃線
紅色下劃線上述錯誤這樣的描述:
No overload for method 'ValidateFilteredRecipient' takes 6 arguments
藍色下劃線的錯誤這樣的描述:
'ValidateBuild': cannot declare instance members in a static class
這我不清楚這兩個錯誤的顯着特徵是什麼。
我認爲找到答案將是一塊蛋糕:我只是谷歌它,第一個結果將是一個MSDN頁面充分闡述這個話題;然而,非常令人驚訝的是,事實並非如此。我開始試圖通過谷歌的顏色(因爲我還不知道紅的意思是「語法錯誤」,藍色意味着「編譯器錯誤」):
visual studio red underline vs. blue underline
沒有幫助那裏。然後我嘗試這些搜索:
visual studio error underline color meanings
visual studio underline color meanings
我看得出來,這是無處可去,所以我用Google搜索了一點,想出了在顏色VS設定:工具>選項>環境>字體和顏色。順便說一下,無法在這裏搜索巨大的列表非常煩人,但我發現「語法錯誤」具有紅色波浪下劃線,「編譯器錯誤」具有藍色波浪下劃線。
那麼做那些呢?返回谷歌:
visual studio compiler error vs. syntax error
相關沒什麼。下面是我發現的最接近,從MSDN:
Fonts and Colors, Environment, Options Dialog Box
這個頁面有這些項:
Compiler Error -- Blue squiggles in the editor indicating a compiler error.
和
Syntax Error -- Parse errors.
一點也不樂於助人 - 對「重點完全「。我一直以爲我知道什麼是「語法錯誤」是,至少,和Wikipedia同意:
a syntax error is an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language.
此外,here is what what it has for syntax:
the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.
所以,從要回我的「語法錯誤」以上:
No overload for method 'ValidateFilteredRecipient' takes 6 arguments
這是怎麼一個語法錯誤每個我已經包含在這裏的定義?其實,在我看來,在「編譯器錯誤」我得到了更緊密地符合這個定義語法錯誤:
'ValidateBuild': cannot declare instance members in a static class
有人可以幫我想出解決辦法?
@AlfieGoodacre - 「你做不到的事情,或者編譯器不會讓你」<--- a.k.a.「你做錯了事情。 –
當我意識到你究竟在深入研究什麼的時候,不情願向上提出一個很好的問題,但也有點毛茸茸的狗故事。紅色的波浪線,藍色的波浪線,我們不能都相處嗎? –
@JeroenMostert - 我完全明白。但是它不會影響你?我的意思是,這是一個商用的企業級IDE ....爲了解決一個難題,至少...爲什麼它們不只是一種錯誤類型?爲什麼他們沒有記錄? –