2014-01-30 11 views
5

이 특정 이미지로 인해 내 응용 프로그램이 OutOfMemoryException과 충돌을 일으키는 이유는 무엇입니까? 이 특정 이미지로 인해 내 응용 프로그램이 OutOfMemoryException과 충돌을 일으키는 이유는 무엇입니까?

enter image description here

나는 간단한 창 정말 간단한 WPF Windows 응용 프로그램을 만들어 : 그것은 x86 또는 64 인 경우

<Window x:Class="DeleteMe.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Title="MainWindow" Height="350" Width="525"> 
    <Grid> 
     <Image Source="C:\Path\To\The\Image\MyImage.png" RenderOptions.BitmapScalingMode="Fant"></Image> 
    </Grid> 
</Window> 
  • 그것은 중요하지 않습니다.
  • 이미지 파일을 1 픽셀 씩 크기를 조정하면 작동합니다.
  • 이미지에 몇 개의 픽셀을 추가하고 저장하면 여전히 작동하지 않습니다.
  • 문제는 FantHighQuality 비트 맵 배율 모드에서만 발생합니다.

이것이 문제가되는 이유는이 이미지를 만드는 사람으로부터 얻은 모든 이미지의 크기를 조정해야하기 때문입니다. 나는 Paint.Net을 사용하여 사람과 같은 이미지 작업을하고 있습니다.

감사합니다.

지금까지 내가 당신의 문제는 WPF에서 알려진하지만 현재 확인되지 않은 버그에 해당 말할 수
Application: DeleteMe.exe 
Framework Version: v4.0.30319 
Description: The process was terminated due to an unhandled exception. 
Exception Info: System.OutOfMemoryException 
Stack: 
    at System.Windows.Media.Composition.DUCE+Channel.SyncFlush() 
    at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean, System.Nullable`1 
<ChannelSet>) 
    at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr) 
    at System.Windows.Interop.HwndTarget.HandleMessage(MS.Internal.Interop.WindowMessage, IntPtr, IntPtr) 
    at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) 
    at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) 
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) 
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) 
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) 
    at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) 
    at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) 
    at System.Windows.Threading.Dispatcher.Run() 
    at System.Windows.Application.RunDispatcher(System.Object) 
    at System.Windows.Application.RunInternal(System.Windows.Window) 
    at System.Windows.Application.Run(System.Windows.Window) 
    at System.Windows.Application.Run() 
    at DeleteMe.App.Main() 
+0

이전 버전의 .Net에서는 이미지 형식이 잘못된 이미지를로드 할 때 일부 이미지 API가 OOM을 발생시키는 것을 기억합니다. 치명적인 프로세스 충돌 OOM이 아니 었습니다. 단지 "이 이미지의 크기가 잘못되었습니다"OOM입니다. 아마 여기에서 일어나는 일이있을 것입니다. 그냥 이미지를 직접로드하려고하면 그게 작동하는지 아니면 던져 지는지 확인하십시오. – JaredPar

+0

도달하지만 프로젝트에서 이미지를 시도하십시오. – Paparazzi

+2

위와 같은 XAML로 추가 할 때 이것은 나를 위해 불어 나지 않습니다. 코드 숨김에 아무 것도 없나요? 그래픽 드라이버가 최신 버전입니까? – Matt

답변

0

, Microsoft Connect를 참조하십시오

내 이벤트 뷰어는 다음 날 수 있습니다. 재미있게도이 문제는 중복으로 표시되어 있지만 다른 문제는 찾을 수 없습니다. 그것은 단지 내부 있다면 나는

해결 방법을 ... 놀라지 않을 것

문제가 정말 위의 버그에 연결되어있는 경우, 쉬운 해결 방법은 : 그냥 당신의 팔레트 기반 PNG8로 변환 비 팔레트 기반 PNG24. 예를 들어, 포토샵 또는 김프를 사용하여.