Telerik.WinControls.UI.GridException error

本文关键字:error GridException UI WinControls Telerik | 更新日期: 2023-09-27 18:12:22

我正在开发一个使用Telerik WinForms的WinForms应用程序。几个月前我接手了维护应用程序,现在我需要编辑一个使用这些表单的表单。但每次打开表单都会出现这个错误。无论我是否尝试调试代码,通过Visual Studio,在测试服务器上或在生产中。每次都是一样的。试着重新启动电脑,试着重新安装Rad控件,Visual Studio…它还是一样的。在另外一台电脑上试用了一下,它在任何地方都能运行——除了我的电脑。所有其他使用相同电erik gridview的表单都有效。现在我不能使用也不能编辑这个表单。有人知道如何解决这个问题吗?问题是什么?

PS:这里是整个错误日志:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
Telerik.WinControls.UI.GridException: Cannot find column with UniqueName 'Product'
   at Telerik.WinControls.UI.GridViewColumnCollection.FindByUniqueName(String UniqueName)
   at Telerik.WinControls.UI.GridViewColumnCollection.get_Item(String name)
   at CustomerCare.Product.frmProducts.gvProducts_SizeChanged(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
   at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
   at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
   at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
   at Telerik.WinControls.RadControl.Telerik.WinControls.IComponentTreeHandler.CallSetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
   at Telerik.WinControls.ComponentLayoutElementTree.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
   at Telerik.WinControls.RadControl.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
   at System.Windows.Forms.Control.ScaleControl(SizeF factor, BoundsSpecified specified)
   at System.Windows.Forms.ScrollableControl.ScaleControl(SizeF factor, BoundsSpecified specified)
   at Telerik.WinControls.RadControl.ScaleControl(SizeF factor, BoundsSpecified specified)
   at System.Windows.Forms.Control.ScaleControl(SizeF includedFactor, SizeF excludedFactor, Control requestingControl)
   at System.Windows.Forms.Control.Scale(SizeF includedFactor, SizeF excludedFactor, Control requestingControl)
   at System.Windows.Forms.Control.ScaleChildControls(SizeF includedFactor, SizeF excludedFactor, Control requestingControl)
   at System.Windows.Forms.ContainerControl.Scale(SizeF includedFactor, SizeF excludedFactor, Control requestingControl)
   at System.Windows.Forms.ContainerControl.PerformAutoScale(Boolean includedBounds, Boolean excludedBounds)
   at System.Windows.Forms.ContainerControl.PerformNeededAutoScaleOnLayout()
   at System.Windows.Forms.ContainerControl.OnLayoutResuming(Boolean performLayout)
   at System.Windows.Forms.Control.ResumeLayout(Boolean performLayout)
   at CustomerCare.Product.frmProducts.InitializeComponent()
   at CustomerCare.Product.frmProducts..ctor()
   at CustomerCare.frmMain.vertMeni_ItemClicked(Object sender, ItemClickedEventArgs e)
   at vbAccelerator.Components.ListBarControl.ListBar.OnItemClicked(ItemClickedEventArgs e)
   at vbAccelerator.Components.ListBarControl.ListBar.MouseSelectItem(ListBarItem item, MouseEventArgs e)
   at vbAccelerator.Components.ListBarControl.ListBar.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5477 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
CustomerCare
    Assembly Version: 1.0.5302.15719
    Win32 Version: 1.0.5302.15719
    CodeBase: file:///C:/Program%20Files/MakTel/Customer%20Care/CustomerCare.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5459 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
acclListBar
    Assembly Version: 1.0.1326.27884
    Win32 Version: 1.0.1326.27884
    CodeBase: file:///C:/Program%20Files/MakTel/Customer%20Care/acclListBar.DLL
----------------------------------------
Interop.EnCodecDLL
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.0.0
    CodeBase: file:///C:/Program%20Files/MakTel/Customer%20Care/Interop.EnCodecDLL.DLL
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Transactions
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
Telerik.WinControls.UI
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.0.0
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Telerik.WinControls.UI/6.0.0.0__5bb2a467cbec794e/Telerik.WinControls.UI.dll
----------------------------------------
Telerik.WinControls
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.0.0
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Telerik.WinControls/6.0.0.0__5bb2a467cbec794e/Telerik.WinControls.dll
----------------------------------------
System.Web.Services
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Web.Services/2.0.0.0__b03f5f7f11d50a3a/System.Web.Services.dll
----------------------------------------
System.Design
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Design/2.0.0.0__b03f5f7f11d50a3a/System.Design.dll
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Drawing.Design
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing.Design/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.Design.dll
----------------------------------------
TelerikCommon
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.0.0
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/TelerikCommon/6.0.0.0__5bb2a467cbec794e/TelerikCommon.dll
----------------------------------------
Telerik.WinControls.GridView
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.0.0
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Telerik.WinControls.GridView/6.0.0.0__5bb2a467cbec794e/Telerik.WinControls.GridView.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
编辑:

我从visual studio中删除了代码,并设法在调试模式下启动表单。下面是代码:

private void gvProducts_SizeChanged(object sender, EventArgs e)
        {
            #region gvProducts_SizeChanged
            if (gvProducts.Size.Width > gvProductsSmallSize.Width)
            {
                gvProducts.MasterGridViewTemplate.Columns["Product"].Width = ((gvProducts.Size.Width - gvProductsSmallSize.Width) / 2) + 450;
                gvProducts.MasterGridViewTemplate.Columns["ProductGroupName"].Width = ((gvProducts.Size.Width - gvProductsSmallSize.Width) / 2) + 350;//this.Size.Width - frmProductSmallSize.Width + gvProducts.MasterGridViewTemplate.Columns["ProductGroupName"].Width;
            }
            else
            {
                gvProducts.MasterGridViewTemplate.Columns["Product"].Width = 450;
                gvProducts.MasterGridViewTemplate.Columns["ProductGroupName"].Width = 350;
                gvProducts.MasterGridViewTemplate.Columns["Status"].Width = 55;
            }
            #endregion
        }

我可以编辑表单,但不能在生产环境中试用。有人能想到变通办法吗?我想这是windows的问题或者类似的问题。

Telerik.WinControls.UI.GridException error

您应该尝试检查DesignMode属性并禁用作为各种事件处理程序结果执行的代码。

否则,请联系Telerik Support寻求帮助(或在他们的论坛上发帖)。