Hello :)
A user of our software encountered a difficult to reproduce bug. Our software crashed with a System.ComponentModel.Win32Exception in relation to the UltraDesktopAlert. The stack trace looks like this:
Stack trace: at System.Windows.Forms.Form.UpdateLayered() at System.Windows.Forms.Form.set_Opacity(Double value) at Infragistics.Win.DesktopAlertWindowFormBase.ShowWindow(Rectangle bounds, Single opacity) at Infragistics.Win.Misc.UltraDesktopAlertWindow.Show(Rectangle initialBounds, Single initialOpacity) at Infragistics.Win.Misc.UltraWinDesktopAlert.DesktopAlertWindowAnimationManager.Start(AnimationSequence animationSequence, Boolean mouseEnter) at Infragistics.Win.Misc.UltraWinDesktopAlert.DesktopAlertWindowAnimationManager.Stop() at Infragistics.Win.Misc.UltraDesktopAlertWindowInfo.BeforeCloseHelper(DesktopAlertCloseReason closeReason) at Infragistics.Win.Misc.UltraWinDesktopAlert.DesktopAlertWindowAnimationManager.OnAutoCloseTimerTick(Object sender, EventArgs e) at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Research in our development team found that this might be because the window's opacity is set when the window already has been disposed of, as per http://social.msdn.microsoft.com/Forums/en/winforms/thread/71ae31e0-13e2-48b7-9883-2e7f724f5171 .
Given the only spot our own code touches anything in relation to timing and the desktop alerts is setting the autoclose delay, we believe this might be an issue with the UltraDesktopAlert.
To provide as much (hopefully useful) detail as possible, I enclosed details below.
With best regards,C. Kopp
public DesktopAlertHandler(IIconResourceService iconResourceService){ m_IconResourceService = iconResourceService; m_DesktopAlert = new UltraDesktopAlert(); m_DesktopAlert.AnimationStyleShow = AnimationStyle.None; m_DesktopAlert.AnimationStyleAutoClose = AnimationStyle.Fade; m_DesktopAlert.Style = DesktopAlertStyle.Office2007; m_DesktopAlert.AutoCloseDelay = 10000; m_DesktopAlert.AutoClose = DefaultableBoolean.True; m_DesktopAlert.MultipleWindowDisplayStyle = MultipleWindowDisplayStyle.None; m_DesktopAlert.TreatCaptionAsLink = DefaultableBoolean.False; m_DesktopAlert.TreatFooterTextAsLink = DefaultableBoolean.False; m_DesktopAlert.TreatTextAsLink = DefaultableBoolean.False; m_DesktopAlert.DesktopAlertLinkClicked += OnDesktopAlertLinkClicked; m_DesktopAlert.DesktopAlertClosing += OnDesktopAlertClosing;}private void OnDesktopAlertLinkClicked(object sender, DesktopAlertLinkClickedEventArgs e){ if (e.LinkType != DesktopAlertLinkType.Text && e.LinkType != DesktopAlertLinkType.Caption) { return; } e.CloseWindow = true; // ...}private void OnDesktopAlertClosing(object sender, DesktopAlertClosingEventArgs e){ // ...}
The client's environment is this:
--- Environment ---CLR: .NET Framework 2.0.50727.3623CLR Type: .NETCLR Version: 2.0.50727.3623Platform: Win32NTOS: Microsoft Windows XP Professional Service Pack 3OS Version: 5.1.2600.196608ARCH: x86Culture: de-CHUI Culture: en-USRunning with 32-bit.Working directory: C:\Documents and Settings\<foo>\My Documents\<bar>\<baz>
Hello ,
Which version of Infragistics you are using ? Please test the latest service release of Infragistics 11.2, if the issue is caused from Infragistics, then it may be is fixed in the latest release of 11.2.
From your stack trace I see that may be you are using a timer for some purpose and may be you are setting opacity of the from in the tick event of the timer, am I right ? If I am right you should check the code in the tick event of the timer.
Please let me know if you have any further questions.
Hello :)Thank you for your input. I apologize for the delay in reply.I am afraid our project is not yet ready to integrate version 11.2 of the Infragistics solutions and as such it would have been difficult to test for this issue. Currently, we are using version 9.2 (9.2.20092.1003) Especially considering that this error is highly intermittent and tough to pin down.We are not actively using timers on our own, but rather setting the UltraDesktopAlert.AutoCloseDelay property. I was surprised to find no timer-related code by ourselves. This is what led me to consider it might be an unfortunate happenstance between the UltraDesktopAlert and how we use it. Yet there is only simple code in the DesktopAlertClosing event handler; see below.If this has been solved in the meantime, I apologize for having taken up so much of your time.
private void OnDesktopAlertClosing(object sender, DesktopAlertClosingEventArgs e){ if (_DetailLinkClicked > 0) { e.Cancel = true; }}
Hello,
I've built a small sample using the provided code, but I was unable to reproduce the issue. I'm not sure what steps I should take to reproduce it. Can you please let me know what the user was doing when this exception occurred?
Please test this sample on your end, and let me know whether you see the exception. If not, we'll have to look at some more code to find the cause.
Hello, and thank you for your intensive search.
Unfortunately I can not offer much detail about this; it is a very, very intermittent event. The project has been going on for years, is still under active development, yet this particular event only happened two or three times (to the extent of my knowledge). That an actual, external user had this happen seems to me like an instance of Murphy's Law.
While this luckily means it is not a critical mishap in our product, it unfortunately also means I am sorry I cannot provide details about the circumstances.
Best regards,
Cornelius
Hi Cornelius,I have discussed this issue with our engineers. The team looked into our desktop alert code for the methods listed in the call stack, as well as the code for the UpdateLayered method. Here's the code for UpdateLayered:
private void UpdateLayered(){ if (((this.formState[FormStateLayered] != 0) && base.IsHandleCreated) && (this.TopLevel && OSFeature.Feature.IsPresent(OSFeature.LayeredWindows))) { bool flag; Color transparencyKey = this.TransparencyKey; if (transparencyKey.IsEmpty) { flag = UnsafeNativeMethods.SetLayeredWindowAttributes(new HandleRef(this, base.Handle), 0, this.OpacityAsByte, 2); } else if (this.OpacityAsByte == 0xff) { flag = UnsafeNativeMethods.SetLayeredWindowAttributes(new HandleRef(this, base.Handle), ColorTranslator.ToWin32(transparencyKey), 0, 1); } else { flag = UnsafeNativeMethods.SetLayeredWindowAttributes(new HandleRef(this, base.Handle), ColorTranslator.ToWin32(transparencyKey), this.OpacityAsByte, 3); } if (!flag) { throw new Win32Exception(); } } }
}
We can see that the exception is most likely thrown due to something that occurred in SetLayeredWindowAttributes. However, without more information, we have no way to know what specifically went wrong - We cannot tell the state of memory, the values of parameters, etc.If this issue does come up again and you are able to gather more information, please let me know and I will forward it on to our engineers.
Hello! :)
Thank you for your care and effort. I am sorry that I could not provide more information. The code you included will give us pointers what to look for; if this error happenes ever again, I will get back to you with as much detail as we can gather.