첨부 된 디버거가있는 장치에서이 샘플 프로그램을 시작하면 심각한 오류가 발생합니다..NET CF 3.5 및 CE 6 R3 심각한 오류를 방지하는 방법
이것은 실제 응용 프로그램에서 일어나는 일들을 요약 한 것입니다. 내가 발견 무엇
은 다음과 같습니다- 디버거는
- 메모리가 어떻게 든 채워 져야 첨부해야합니다
- 쓰레기 (비트 맵) 오브젝트가 존재해야합니다 (I이 가비지 수집을 강제로 생각한다). 다른 목적 (Application.Run() 또는 ShowDialog를 사용하는 경우 차이) 양식이 표시되지해야
- 동일한 오류 형태는 볼 때
그 다음 GC는 비트 맵 심각한 수집 초래할 수도 오류가 발생합니다.
.NET Compact Framework 3.5에서 WindowsCE 6 R3을 실행하고 있습니다. 이미 비슷한 질문을하지만 anwser를 발견했습니다
static class Program {
static void Main() {
// Fill up memory - Depends on device
var memory = new int[100000 * 150];
// Settings the priority higher will raise the error earlier.
// With Priority set to Normal the EXE won't get freed correct.
// Without this line i have to reboot the CE after every test run...
Thread.CurrentThread.Priority = ThreadPriority.Highest;
// 80 is just random choosen. The error occurs also with 30 Bitmaps...
for (int o = 1; o < 80; o++) {
// Create a Bitmap and don't free it manually. The
// The garbage collector will take care of it :)
var bitmap = new Bitmap(100, 100);
// When i dispose the Bitmap, everything works fine...
//bitmap.Dispose();
}
// Force a GC run
System.Diagnostics.Debug.WriteLine(GC.GetTotalMemory(true));
// Then error occurs when the form is shown.
System.Windows.Forms.Application.Run(new System.Windows.Forms.Form());
}
}
... 내가 지금까지 시도했습니다 무엇
- How to debug a fatal error that happens after calling Application.Exit() in .NET CF 3.5 WinForms application for Windows CE 6?
- CE 6.0/.NET CF 3.5 Application has encountered a serious error (MC3100)
:
- 청소 리소스를 수동으로. 이미 모든 비트 맵 생성물을 검색하여 처리했거나 캐시했습니다. 오류가 여전히 발생합니다. 비트 맵은 나쁜 것만이 아닙니다.
솔루션에 대한 의견이 맞지 않습니까? "비트 맵을 처리 할 때 모든 것이 정상적으로 작동합니다 ..." – Sayse
문제는 비트 맵이 오류를 발생시키는 유일한 유형이 아니라는 것입니다. 실제 응용 프로그램에서 모든 비트 맵 참조를 수정했습니다. => 오류가 계속 발생합니다. 나는 내가 처리 할 필요가있는 비트 맵보다 더 많은 유형이 있다고 생각한다. 어떤 유형이 "불량"인지 어떻게 알 수 있습니까? 전체 프레임 워크에서 모든 IDisposables를 확인 하시겠습니까? – Benjamin