2008-08-20 2 views
2

코드를 게시 할 수 없지만 (독점적 인 문제는) 누구든지 C#에서 다음과 같은 오류가 발생할 수있는 유형을 알고 있습니다. 호출이 다른 클라이언트에 의해 끝났을 때 counterpath api를 사용하여 작성한 VOIP 클라이언트에 의해 throw됩니다. 오류 :C# 메모리 오류가 손상되었습니다.

System.AccessViolationException was unhandled 
    Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt." 
    Source="System.Windows.Forms" 
    StackTrace: 
     at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) 
     at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) 
     at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) 
     at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) 
     at System.Windows.Forms.Application.Run(Form mainForm) 
     at CollabAnalysisSF.Edge.GUI.Forms.Program.Main() in d:\data\beyerss\Desktop\client\GUI\ARGui\Program.cs:line 18 
     at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) 
     at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
     at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException:

업데이트 : 우리는 우리가 몰랐어요 이벤트를 전송 한 사용 된 라이브러리 중 하나 밝혀, 그리고 문제가 어딘가에 있었다. 이제 해결되었습니다.

답변

3

리스트 :이 배치 된 후에

  • 목적이 사용되고있다. 파이널 라이저에서 관리 객체를 삭제하는 경우이 작업이 많이 발생할 수 있습니다 (그렇게해서는 안됩니다).
  • 사용중인 개체 중 하나의 unmannaged 구현이 도청되어 프로세스 메모리 힙이 손상되었습니다. DirectX, GDI 등에서 많이 사용됩니다.
  • 관리되는 관리되지 않는 경계의 마샬링에 결함이 있습니다. 관리되지 않는 코드 부분에서 사용하기 전에 관리되는 포인터를 고정해야합니다.
  • 안전하지 않은 블록을 사용하고 재미있는 일을하고 있습니다.

당신이 윈도우 폼에 문제가 될 수있는 경우. 그러나 문제는 그것이 일어나고있는 것이 아니라 오히려 정확하게보고되지 않고 있다는 것입니다. 당신은 아마도 여전히 잘못된 것을했을 것입니다.

HWND를 사용하여 오류를 일으키는 컨트롤을 확인할 수 있습니까? 항상 같은가요? 이 컨트롤은 응용 프로그램이 충돌하기 직전에 재미있는 일을하고 있습니까? 컨트롤의 unmannaged 부분이 사용자 정의 윈도우 또는 표준 컨트롤입니까?

1

이러한 종류의 문제는 관리되지 않는 코드를 호출하는 경우 발생할 수 있습니다. dll. 마샬링이 끔찍하게 잘못 될 때 발생할 수 있습니다.

관리되지 않는 코드를 호출하는 경우 알려 주실 수 있습니까? 그렇다면 기본 마샬링 (Marshalling) 또는보다 구체적인 내용을 사용하고 있습니까? 예를 들어 안전하지 않은 코드를 사용하고 계십니까? 포인터와 같은? 이것은 귀하의 문제 일 수 있습니다. 몇몇 가능성

0

다음은 더 자세한 스택 추적입니다. 그것은 TargetSite이 {IntPtr DispatchMessageW(MSG ByRef)}
로 표시되며, 모듈에서이 가 system.windows.forms.dll

있다

System.Windows.Form.dll 함께 할 수있는 뭔가가처럼 나에게 보인다

관련 문제