DataGridView가 null인 경우 예외 없음
이전에는 DataGridView 속성이 null인 경우 DataGridViewHeaderCell.MouseDownUnsharesRow(DataGridViewCellMouseEventArgs), DataGridViewHeaderCell.MouseEnterUnsharesRow(Int32), DataGridViewHeaderCell.MouseLeaveUnsharesRow(Int32) 및 DataGridViewHeaderCell.MouseUpUnsharesRow(DataGridViewCellMouseEventArgs)에서 NullReferenceException이 throw되었습니다. 그 동작은 예기치 못했고 올바르지 않았습니다. DataGridView
가 null
인 경우 단순히 false
를 반환하도록 이러한 메서드가 업데이트되었습니다.
도입된 버전
.NET 9 미리 보기 1
이전 동작
이전에는 DataGridViewHeaderCell.DataGridView
가 null
일 때 영향을 받는 메서드가 NullReferenceException을 발생시켰습니다.
새 동작
.NET 9부터 DataGridViewHeaderCell.DataGridView
속성이 null
인 경우 영향을 받는 메서드는 false
를 반환합니다.
범주 변경
이 변경 사항은 동작 변경입니다.
변경 이유
이전 동작은 올바르지 않습니다.
권장 조치
이 시나리오에서 코드를 사용하여 NullReferenceException을 throw한 경우 대신 반환 값을 확인하도록 코드를 변경합니다.
영향을 받는 API
- System.Windows.Forms.DataGridViewHeaderCell.MouseDownUnsharesRow(DataGridViewCellMouseEventArgs)
- System.Windows.Forms.DataGridViewHeaderCell.MouseEnterUnsharesRow(Int32)
- System.Windows.Forms.DataGridViewHeaderCell.MouseLeaveUnsharesRow(Int32)
- System.Windows.Forms.DataGridViewHeaderCell.MouseUpUnsharesRow(DataGridViewCellMouseEventArgs)
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기