我想不出一个更好的地方来放置它,但这是在 .Net Core 3.1 中被破坏的确切原因
我刚刚开始在 Windows 上的 .Net Core 3.1 中开发一个程序(专门使用 Forms),我要添加的第一个控件是 GridView + DataTable 组合。 在您尝试使用鼠标滚动之前它可以正常工作(是的,滚动条在我尝试过的情况下工作正常)
滚动网格后,表单将崩溃并提供此错误:
Unhandled exception. System.TypeLoadException: Could not load type 'System.Windows.Forms.DataGrid' from assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
at Eto.WinForms.ScrollMessageFilter.IsScrollable(Control control)
at Eto.WinForms.ScrollMessageFilter.PreFilterMessage(Message& m)
at System.Windows.Forms.Application.ThreadContext.ProcessFilters(MSG& msg, Boolean& modified)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Eto.WinForms.Forms.ApplicationHandler.Run()
at Eto.Forms.Application.Run(Form mainForm)
at Your.Program.Main(String[] args) in Your.Program.cs:line here
我在第一句话中提供了这次崩溃的原因,并将切换到不同版本的 .Net Core 以避免这种情况,直到我知道这已经解决。
https://github.com/picoe/Eto/wiki/GridView
感谢您查看我的问题:)
感谢您报告问题。 看起来 DataGrid 已在 .NET Core 3.1 以及许多其他版本中被删除。 请参阅https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed -controls。
在为 .NET Core 构建时,我们需要删除对 Eto.WinForms 中的引用。
感谢您报告问题。 看起来 DataGrid 已在 .NET Core 3.1 以及许多其他版本中被删除。 请参阅https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed -controls。
是的,我已经在我的问题的顶部提到了,很高兴它是已知的 👍
啊,没有意识到你链接到同一个页面.. 😄 再次感谢,这应该相对容易修复,尽管问题是是否添加 netcoreapp31 TFM 或只是#if it out for 3.0+..
我在想添加一个新的 TFM 会将这些问题暴露为编译错误,而不是必须以其他方式处理它们,这样应该会更好。
感谢您提出问题! 这应该在最新的 CI 版本中修复,并将包含在 2.5.1 中。