Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

DatePicker produce weird crash RSS

9 replies

Last post Jul 13, 2009 03:08 PM by ld1453

(0)
  • Triviet

    Triviet

    0 Points

    5 Posts

    DatePicker produce weird crash

    Mar 30, 2009 01:35 PM | LINK

    Hello!

     

    I've got a DatePicker control inside a StackPanel and sometimes when I try to switch date, usually a date in another (later) month, the Silverlight app. crashes and prints the following exception:

    Sys.InvalidOperationException: ManagedRuntimeError error #4004 in control 'Xaml1': System.ArgumentException: Value does not fall within the expected range. at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData) at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData) at MS.Internal.XcpImports.MouseEventArgs_GetPosition(MouseEventArgs args, UIElement relativeTo) at System.Windows.Input.MouseEventArgs.GetPosition(UIElement relativeTo) at System.Windows.Controls.Primitives.ButtonBase.OnMouseMove(MouseEventArgs e) at System.Windows.Controls.Control.OnMouseMove(Control ctrl, EventArgs e) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
    [Break on this error] source));

     As said, this crash happens randomly and doesn't give any more info. than that, and it (apparently) doesn't seem to be anything in my code.

    It happens as soon as I click the new date, I don't even get a chance to see the textbox update with the new date.

    I'd appreciate any input on this, and if it turns out to be a DatePicker-bug, a fix as soon as possible.

    Thanks and regards.

  • ld1453

    ld1453

    Member

    291 Points

    117 Posts

    Re: DatePicker produce weird crash

    Mar 30, 2009 03:40 PM | LINK

    Are you only seeing the error in Firefox?  It sounds very much like the same problem posted here http://silverlight.net/forums/t/78336.aspx

    I don't know of a way to fix it but I think I have a way to reproduce it (see above referenced thread). In my experience if you're not Debugging it isn't a fatal error and so users can keep working but it's still not desirable.  Does your application crash on this error even if you're not debugging it?

  • Triviet

    Triviet

    0 Points

    5 Posts

    Re: Re: DatePicker produce weird crash

    Mar 30, 2009 04:00 PM | LINK

    That's correct, I'm only using Firefox when I test my Silverlight app. But I read the thread and he seems to have the exact same problem I do, it happens randomly and more often if you click it fast and such (and switch months/dates often). I'll see if I can get it to crash in IE too.

    And yes, my app. does crash even if I don't run it in a debugger (I rarely do, I always CTRL + F5)...

    Thanks for your response!

  • ld1453

    ld1453

    Member

    291 Points

    117 Posts

    Re: Re: DatePicker produce weird crash

    Mar 30, 2009 11:03 PM | LINK

     Any luck making it happen in IE?  I tried both myself and you're right, even with something as simple as

    <UserControl xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  x:Class="DatePickerBug.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">
    <basics:DatePicker HorizontalAlignment="Center" VerticalAlignment="Center"></basics:DatePicker>
    </Grid>
    </UserControl>

    it will stop the entire application. I clicked until my forearm started hurting and it doesn't appear to effect IE. Like I said in the other post, I think this has something to do with a control removing itself from the visual tree from within it's own event handler. I ran into the problem while working with making "windows" within my application but I think the root problem is the same. I don't know if it's appropriate to post the same thing again in the "Report a Silverlight Bug" section but I'd consider it if nobody else can find a solution or confirm the bug.
  • Triviet

    Triviet

    0 Points

    5 Posts

    Re: Re: Re: DatePicker produce weird crash

    Mar 31, 2009 02:57 PM | LINK

     Nope, no luck there so far... But I did spot something interesting while checking out the changes for the March release of the Silverlight Toolkit:

    http://silverlight.codeplex.com/Wiki/View.aspx?title=Silverlight%20Toolkit%20March%202009%20change%20list&version=10

    The changes for the DatePicker includes this: "Fixed: Under very rare circumstances it was possible to crash the browser when clicking on the DatePicker. Issue was never reported by users, only discovered during stress tests."

    Could this be our issue? The problem is, I've not found the updated System.Windows.Controls.dll in my March installation, so I've not been able to verify it.

    Could some Silverlight team member comment on this, please?

  • ld1453

    ld1453

    Member

    291 Points

    117 Posts

    Re: Re: Re: DatePicker produce weird crash

    Mar 31, 2009 03:40 PM | LINK

    In the comments on that page it says:

    bwhalversen wrote  Mar 24 at 7:06 PM  I see no DatePicker in the March 2009 Toolkit release. What is the meaning of the DatePicker update comment above? Reflector does not show a DatePicker in the March Toolkit.

     

    shawnoster wrote  Mar 25 at 5:23 PM 
    @bwhalversen - which DatePicker comment are you referring to? The DatePicker source is available in the Toolkit while the signed assembly is distributed via the SDK, this is the reason it is referred to as a "Silverlight Toolkit control". When controls meet a stable quality band then their binaries migrate from the toolkit into the SDK. I hope that clears up why we talk about DatePicker in our release notes.

    bwhalversen wrote  Thu at 3:22 PM  Are the changes to the DatePicker discussed above in the SL 3.0 beta 1 SDK or in a newer version SL 2.0 SDK or in both?

    I couldn't find the  DatePicker in the SL2 source but I do see it in the SL3 source.  I'll have another box up to test SL3 with later today to test it out and see if it fixes the problem.  I'm interested to find out how it was solved (if indeed it was) to apply the same logic to my controls.

  • tadam

    tadam

    Member

    178 Points

    36 Posts

    Re: Re: Re: Re: DatePicker produce weird crash

    Mar 31, 2009 05:07 PM | LINK

    Source code for the Silverlight 2 controls, including DataPicker, are at http://www.microsoft.com/downloads/details.aspx?FamilyID=EB83ED4C-AC85-4DE9-8395-285628EE2254&displaylang=en.

     

    tadam

    -- Please mark the post as answered if I've answered you question.
  • ld1453

    ld1453

    Member

    291 Points

    117 Posts

    Re: Re: Re: DatePicker produce weird crash

    Apr 06, 2009 06:01 PM | LINK

     I setup a new box with SL3B1 and the new DatePicker March Release and this problem is not fixed -- It looks like it's ignored. I'm hoping that it was the right decision to be made for SL3. Let me explain.

    When you're debugging it doesn't crash the browser or thrown an exception anymore but the application still dies and you get the new "White Screen of Death". Because it doesn't give any indication of why the application is stopping we can't be positive it's the same thing.  Strangely enough I found it *easier* to make the error occur in the new Silverlight 3 environment, often on the very first attempt (Click dropdown + Click Calendar). The new environment is slower than my regular development environment so I'm able to click the dropdown and then very quickly in the region where the calendar *should* be before the calendar is visible.

    When you're not debugging no error occurs whatsoever. No browser crash, no application crash, no error message. It's as if the exception is being caught and ignored.

     So, given that this is still Beta 1 and the "FIXED" statement in the Silverlight Toolkit's web page it looks like it will be fixed (at least for end users) for SL3. If it continues to crash the application while I'm debugging I suppose I'll just have to suck it up.

  • izerian

    izerian

    Member

    18 Points

    12 Posts

    Re: Re: Re: DatePicker produce weird crash

    Jul 13, 2009 01:41 PM | LINK

    Shameless bump... Has anyone found a solution and/or a cause to this problem?

    white screen

  • ld1453

    ld1453

    Member

    291 Points

    117 Posts

    Re: Re: Re: DatePicker produce weird crash

    Jul 13, 2009 03:08 PM | LINK

    Mr. Wick revealed the cause of it and a possible workaround in this thread. I tried it out again in my SL3 RTW environment and got the same results: a crash without any information in debug and no error when not.

    It doesn't seem like something that can't be lived with if there are no other side effects. Have you had any?