Silverlight 5 AccessViolationException

后端 未结 5 1949
别跟我提以往
别跟我提以往 2021-01-20 22:11

I installed the Silverlight 5 VS 2010 tools and the 64-bit Developer runtime and now I get a System.AccessViolationException when I do a specific action. The projects are st

相关标签:
5条回答
  • 2021-01-20 22:15

    I'm seeing this exception when databinding to a hidden element. We have some fields that are visible or not based on some databinding, but both of those fields are updated with another databinding. When the RaisePropertyChanged is fired on the hidden field we get the AccessViolationException. I had to add some checks to my code to suppress the RaisePropertyChanged when the control isn't visible.

    0 讨论(0)
  • 2021-01-20 22:21

    We "were" experiencing this problem after updating to Silverlight 5. The AccessViolationException was being thrown when setting (sender as RadComboBox).ItemsSources during the loading event of various controls. This error was difficult to reproduce and did not always throw under identical test conditions. However, I believe the best work around is as follows:

    Silverlight 4:

    (sender as RadComboBox).ItemsSource = OurClass.MakeOurList();
    

    The issues disappeared when I added...

    Silverlight 5:

    (sender as RadComboBox).UpdateLayout();
    
    (sender as RadComboBox).ItemsSource = OurClass.MakeOurList();
    

    I am sure this is a "work around" at best, and hope to hear a better solution. But for now we are back up and running!

    0 讨论(0)
  • 2021-01-20 22:26

    There is a Microsoft Connect bug report for the same problem that we submitted a couple of hours ago. Please, vote so that it could be fixed as soon as possible.

    RadComboBox already contains a workaround so please, check the latest internal build under your account and let us know if the problem persists. Here is the Telerik forum thread about the same problem.

    I hope this helps.

    0 讨论(0)
  • 2021-01-20 22:29

    I've updated the DateTimePicker.xaml for my custom Theme to use Microsoft’s Textbox vs. RadWatermarkText as my workaround. The crashing has stopped however the watermark feature is obviously gone.

    I downloaded a theming project from Telerik about a year ago so I could make their controls look almost as good as the default ones. If any of you wish to do the same as I then you'll find DateTimePicker.xaml in their download.

    I found the Telerik controls to be too buggy for my taste so I choose not to continually pay them for bug fixes via subscription.

    0 讨论(0)
  • 2021-01-20 22:29

    I finally tracked down my specific problem. It was only happening with an element after my inherited ChildWindow.

    I had this hack that was trying to fix a bug I had a few months ago. Once I removed it, the exception stopped happening. I'm pretty certain I don't need the hack anymore because of improvements elsewhere, so it's a double bonus! I tried in several places to marshal the calls back to the UI thread, but something in the timer (which is supposed to be on the UI thread) was not allowing it (that's my theory). Good luck to everyone looking for the answer. +1 for the ones so far!

    this.Closed += (s, e) =>
    {
    var timer = new System.Windows.Threading.DispatcherTimer();
    timer.Interval = TimeSpan.FromSeconds(.25);
    timer.Tick += (object senderTimer, EventArgs eTimer) =>
    {
        timer.Stop();
    
        // without the timer, the content will disappear before the window closes
        this.contentHolder.Child = null;
    };
    
    timer.Start();
    };
    

    I wasn't able to reproduce this with a ChildWindow in a separate project. So this answer isn't that useful.

    0 讨论(0)
提交回复
热议问题