日期:2014-05-17  浏览次数:20852 次

[超级难!]将一个AppDomain中的From, 显示到主AppDomain中的DockPanel中, 报错.大家帮帮忙.
本帖最后由 yeah_1999 于 2011-08-19 21:58:00 编辑


asmLoader = new SeperateAppDomainAssemblyLoader();
            asmLoader.LoadAssemblies("TQ.dll");
            DockContent dc = asmLoader.OpenWindow("TQ.PXTQPZ1");

            try
            {
                dc.Show(dockPanel1);  // dc.Show() 就没问题.
            }
            catch (Exception err)
            {
                Console.Write(err.ToString());
            }


窗口直接Show, 是没问题的, 但是显示在DockPanel中,就报错:

System.Runtime.Serialization.SerializationException: 程序集“System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”中的类型“System.Windows.Forms.Control+ControlCollection”未标记为可序列化。
   在 System.Windows.Forms.Control.get_Controls()
   在 System.Windows.Forms.Control.set_ParentInternal(Control value)
   在 System.Windows.Forms.Control.set_Parent(Control value)
   在 WeifenLuo.WinFormsUI.Docking.DockPane.SetParent(Control value) 位置 C:\Users\hy\Desktop\DockPanel\WinFormsUI\Docking\DockPane.cs:行号 688
   在 WeifenLuo.WinFormsUI.Docking.DockPane.SetParent() 位置 C:\Users\hy\Desktop\DockPanel\WinFormsUI\Docking\DockPane.cs:行号 667
   在 WeifenLuo.WinFormsUI.Docking.DockPane.RefreshStateChange(INestedPanesContainer oldContainer, DockState oldDockState) 位置 C:\Users\hy\Desktop\DockPanel\WinFormsUI\Docking\DockPane.cs:行号 960
   在 WeifenLuo.WinFormsUI.Docking.DockPane.ResumeRefreshStateChange(INestedPanesContainer oldContainer, DockState oldDockState) 位置 C:\Users\hy\Desktop\DockPanel\WinFormsUI\Docking\DockPane.cs:行号 942
   在 WeifenLuo.WinFormsUI.Docking.DockPane.InternalSetDockState(DockState value) 位置 C:\Users\hy\Desktop\DockPanel\WinFormsUI\Docking\DockPane.cs:行号 917
   在 WeifenLuo.WinFormsUI.Docking.DockPane.SetDockState(DockState value) 位置 C:\Users\hy\Desktop\DockPanel\WinFormsUI\Docking\DockPane.cs:行号 860
   在 WeifenLuo.WinFormsUI.Docking.DockPane.InternalConstruct(IDockContent content, DockState dockState, Boolean flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, Double proportion, Boolean show) 位置 C:\Users\hy\Desktop\DockPanel\WinFormsUI\Docking\DockPane.cs:行号 117
   在 WeifenLuo.WinFormsUI.Docking.DockPane..ctor(IDockContent content, DockState visibleState, Boolean show) 位置 C:\Users\hy\Desktop\DockPanel\WinFormsUI\Docking\DockPane.cs:行号 56
   在 WeifenLuo.WinFormsUI.Docking.DockPanelExtender.DefaultDockPaneFactory.CreateDockPane(IDockContent content, DockState visibleState, Boolean show) ?恢?C:\Users