Crash occurs for some images
I add a System.Windows.Controls.Image to a Canvas in a window.
For some images i get an exception with the following stack trace.
" at System.Windows.Media.MediaContext.NotifyPartitionIsZombie(Int32 failureCode)\r\n at System.Windows.Media.MediaContext.NotifyChannelMessage()\r\n at System.Windows.Media.MediaContext.CompleteRender()\r\n at System.Windows.Interop.HwndTarget.OnResize()\r\n at System.Windows.Interop.HwndTarget.HandleMessage(Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)\r\n at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)\r\n at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)\r\n at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)\r\n at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)\r\n at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)\r\n at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)\r\n at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)\r\n at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)\r\n at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)\r\n at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)\r\n at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)\r\n at MS.Win32.UnsafeNativeMethods.SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, Int32 x, Int32 y, Int32 cx, Int32 cy, Int32 flags)\r\n at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)\r\n at System.Windows.Window.CreateSourceWindowImpl()\r\n at System.Windows.Window.SafeCreateWindow()\r\n at System.Windows.Window.ShowHelper(Object booleanBox)\r\n at System.Windows.Window.Show()\r\n at System.Windows.Window.ShowDialog()\r\n at Teradion.DIMMainWindow.ResourcePreview(Uri uri) in F:\\StandardOnly\\Teradion\\MainWindow.xaml.cs:line 18285"
Please help.
Thanks in advance.
Sakthi Sai Saranyan
Todas las respuestas
- Can you make sure that you have the latest drivers for your video card?
- I'm having a very similar issue: inside a Canvas object, I'm creating a number of Image objects. The following code produces a nasty crash which the debugger won't let me catch -- even though I'm running the program from the VS2005, in Debug mode.
Uri uri = new Uri("pack://application:,,/Images/Circle.png");
BitmapImage bitmap = new BitmapImage(uri);
Image img = new Image();
img.Source = bitmap;
this.Children.Add(img);
If I comment out either of the last two lines, the crash goes away. (And so do the images, of course.)
This phenomenon only occurs on one of my machines: a dual-CPU machine with an nVidia 4500x2 card. The drivers are the latest version: 91.85. I've also run the application on a Vista machine and on an XP laptop, and it works fine.
Any help greatly appreciated. - any particular images or certain number that you've noticed it has the most problems with?
- I tried it with a different image in the project (also a .png) -- it didn't seem to make any difference. I'll try a jpg and post the results. I'll also try a relative URI, just for the heck of it.
- I was wondering if there might be some issue with the Uri, so I tried relative. I also tried a jpg instead of a png. The result is the same. It's a strange crash -- the debugger simply doesn't catch it. The traditional "Debug/Send/Don't Send" dialog comes up. If you click "Debug", it offers to open a copy of Visual Studio. If you do this, however, it will eventually refuse, because "Unable to attach to the crashing process. A debugger is already attached."
I've written the minimal version of the program that will reproduce this behavior. Here it is:public class MainWindow : Window
{
Canvas mainCanvas;
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run( new MainWindow() );
}
public MainWindow()
{
// Create canvas
mainCanvas = new Canvas();
Content = mainCanvas;
mainCanvas.Width = Width;
mainCanvas.Height = Height;
Uri uri = new Uri("diamondgraph.jpg", UriKind.Relative);
BitmapImage bitmap = new BitmapImage(uri);
Image img = new Image();
img.Source = bitmap;
mainCanvas.Children.Add(img);
Canvas.SetLeft(img, 0);
Canvas.SetTop(img, 0);
img.Width = 300;
img.Height = 300;
}
} - You would normally want to call InitializeComponent prior to your code in the MainWindow's constructor. (If you don't call it, things aren't initialized properly -- like the mainCanvas.Width property gets set to Auto rather than the actual width of the Window.
I'm sure you'll hate to hear this, but both with and without the call to InitializeComponent, it works fine for me with the jpg I tried. I used an absolute path in my test.
I figured out how to solve this problem, though I'm still mystified as to the underlying cause. What I did was to I install the "DirectX End-User Runtime Web Installer" on the machines where the application would not run. The application just worked after that.
Note that this is different from the "DirectX End-User Runtime" download package which is the generally first hit to come up on Google (and on MSDN). That package (version number 9.0c) has a release date in 2004. The Web Installer package has a release date of 6/12/2007, and a sort of "version number" of "9.19.1005" (Have the DirectX version number people been drinking at work?). This kind of update has never been offered through Windows Update, as far as I know. It's just something I dug up and decided to try.
So I had run the test WPF application on various machines, under XP and Vista, with graphics cards (nVidia Quadro 4500x2, nVidia Quadro 3000, nVidia Quadro 3400, laptop chipset, etc.) and driver versions (91.36, 91.85, etc.). .NET 3.0 was installed on all the machines. There just didn't seem to be any reliable predictor of when the application would fail.
But the Web Installer fixed the crashing issue on every machine.- One of my users of MuvUnder Cover was getting the same error related to the System.Windows.Media.MediaContext.NotifyPartitionIsZombie call. They already had Vista SP1 and .NET 3.5 installed so the transparency hotfix didn't apply.
Having them run the DirectX End-User Runtime Web Installer, as mentioned here fixed the issue for them. The problem for me is that my program was written against .NET 3.5 which is already a 30MB+ download depending on their OS and the DirectX End-User Runtime Web Installer is an additional 22 KB - 61.2 MB (from there site, though on my VM it was about 60MB), which means to install my program and to avoid any possibility of that error would require 90-120MB of downloads for the user...obviously something I'd like to avoid.
Is there any idea exactly what file is causing the issue and is getting updated when the DirectX End-User Runtime Web Installer is run and is there anyway we could get a hotfix for just that file, or files if it's more than one?
Thanks,
John
MuvEnum - Hi All,
Did anyone ever find what was causing this issue? It happens to me in WPF aswell on brand new IBM Anyplace Kiosks. I developed a Kiosk application which worked great on all my (different) test machines but when I went to deploy to production this problem reared its ugly head. Unfortunately installing the Direct X end user runtime doesn't help. Anybody have any other ideas?
Crashdump here:
0016e798 774f9a94 [HelperMethodFrame: 0016e798]
0016e83c 0539df31 System.Windows.Media.MediaContext.NotifyPartitionIsZombie(Int32)
0016e850 05667409 System.Windows.Media.MediaContext.NotifyChannelMessage()
0016e8c4 04e62bb4 System.Windows.Interop.HwndTarget.HandleMessage(Int32, IntPtr, IntPtr)
0016e8f4 04e5fd9a System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
0016e918 6eac635e MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
0016e964 6eac628a MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
0016e974 6eac617a System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Boolean)
0016e998 6eac606a System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Boolean, System.Delegate)
0016e9e0 6eac4254 System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate, System.Object, Boolean, System.Delegate)
0016ea00 6eac33b1 System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Boolean)
0016ea44 6eac3300 System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority, System.Delegate, System.Object)
0016ea68 6eac59cc MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
0016ebf4 001709dc [NDirectMethodFrameStandalone: 0016ebf4] MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
0016ec04 6eac39f7 System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
0016ec54 6eac30c9 System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
0016ec60 6eac306c System.Windows.Threading.Dispatcher.Run()
0016ec6c 68b4d46e System.Windows.Application.RunDispatcher(System.Object)
0016ec78 68b4c76f System.Windows.Application.RunInternal(System.Windows.Window)
0016ec9c 68b33aa6 System.Windows.Application.Run(System.Windows.Window)
0016ecac 68b33a69 System.Windows.Application.Run()
0016ecb8 00b700bc Ticket_Dispenser.App.Main()
Regards,
Ed- EditadoEd Bosher miércoles, 03 de septiembre de 2008 1:02Bracket in wrong place

