Silverlight 5 AccessViolationException

后端 未结 5 1996
别跟我提以往
别跟我提以往 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: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.

提交回复
热议问题