Visual Studio 디버거가 제네릭 형식 인수가 포함 된 식을 제대로 평가하지 않는 이유는 무엇입니까?
다음 코드에서 : private static void Main(string[] args)
{
var listy = new List<DateTime> { DateTime.Now };
MyMethod(listy);
}
static void MyMethod<T>(List<T> myList)
{
// put breakpoint here
}
"myList"에서 QuickWatch를 열면 다음과 같이 보입니다.
myList
[0]
Raw View
"[0]"노드를 선택하고 추가를 클릭하면 watch : Watch에 추가 된 표현식 :
(new System.Collections.Generic.Mscorlib_CollectionDebugView<System.DateTime>(myList)).Items[0]
이 표현식은 정확하지만 시계 창에 다음 오류가 표시됩니다.
The best overloaded method match for 'System.Collections.Generic.Mscorlib_CollectionDebugView.Mscorlib_CollectionDebugView(System.Collections.Generic.ICollection)' has some invalid arguments
이것은 디버거의 버그처럼 보입니다 . 왜 이런 일이 생길까요? 그리고 그것은 어디서나 문서화되어 있습니까?
그것은 myList와 어떻게 든간에 문제가, 당신이 정적 변수를 사용하면 작동합니다. connect.microsoft.com에 게시 –
Microsoft [내가 고정 된 버그 신고서를 작성했습니다] (https://connect.microsoft.com/VisualStudio/feedback/details/684678/visual-studio-debugger-c-expression-evaluator- 바인드되지 않은 제네릭 타입), 잘하면 dev11에서 이런 일이 일어나지 않을 것입니다. –