GithubHelp home page GithubHelp logo

Comments (7)

kant2002 avatar kant2002 commented on August 15, 2024

Is this .NET 5 or .NET 6, I think I have this bug fixed in .NET 6, if not, I would recommend you to custom build WinForms which is very easy IMO.

from winformscominterop.

timiil avatar timiil commented on August 15, 2024

should be .NET 6, the 'OpenFileDialog' is also throw an exception :

System.InvalidCastException
  HResult=0x80004002
  Message=Unable to cast object of type 'WinFormsComInterop.IExternalObject' to type 'IFileOpenDialog'.
  Source=System.Private.CoreLib
  StackTrace:
   在 System.Runtime.CompilerServices.CastHelpers.ChkCast_Helper(Void* toTypeHnd, Object obj)
   在 System.Windows.Forms.OpenFileDialog.CreateVistaDialog()
   在 System.Windows.Forms.FileDialog.TryRunDialogVista(IntPtr hWndOwner, Boolean& returnValue)
   在 System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
   在 System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
   在 System.Windows.Forms.CommonDialog.ShowDialog()
   在 BYHKTools.frmDevice.<.ctor>b__3_7(Object _, EventArgs _) 在 D:\code\faceconsole2\BYHKTools\frmDevice.cs 中: 第 211 行
   在 System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
   在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

from winformscominterop.

darkguy2008 avatar darkguy2008 commented on August 15, 2024

Is this .NET 5 or .NET 6, I think I have this bug fixed in .NET 6, if not, I would recommend you to custom build WinForms which is very easy IMO.

Any ideas on how to build custom WinForms ourselves? You mention it twice in some other issues but I fail to see how easy it is without at least a pointer to some page, link or howto explaining how easy it is. Much appreciated!

from winformscominterop.

kant2002 avatar kant2002 commented on August 15, 2024

Any ideas on how to build custom WinForms ourselves?

you literally

  1. clone https://github.com/dotnet/winforms
  2. Run build.cmd
  3. Add produced binaries as reference
    Location of outputs are described on build instructions page https://github.com/dotnet/winforms/blob/main/docs/building.md#build-outputs

from winformscominterop.

darkguy2008 avatar darkguy2008 commented on August 15, 2024

Any ideas on how to build custom WinForms ourselves?

you literally

  1. clone https://github.com/dotnet/winforms
  2. Run build.cmd
  3. Add produced binaries as reference
    Location of outputs are described on build instructions page https://github.com/dotnet/winforms/blob/main/docs/building.md#build-outputs

Hey, thanks for your quick answer! I had seen that repo but I was skeptical that it would be just like you say and that the repo was compatible and/or had the full source code to make a working Windows.Forms implementation. Usually Microsoft code is full of riddles and sometimes it's the equivalent of attempting to build a linux kernel 😂 it's kinda surprising, so I'll give that a try, thank you!

Assuming it works though, this means that it would solve the COM issues when using this lib and/or NativeAOT with Windows Forms, right?

from winformscominterop.

kant2002 avatar kant2002 commented on August 15, 2024

this means that it would solve the COM issues when using this lib

If you take latest main branch. Apply dotnet/winforms#5319 on top of it, that specific issue would be gone. If you have another issue in another control, for me this is separate issue and please post separately/

Aforementioned PR is about to get finished, so expect to just use main branch. Overall WinForms team positive to AOT of WinForms and I expect that this project would dissolve itself, since WinForms would be ready for AOT by itself.

Just in case you would be interested. If you have bug with Windows Forms it is trivial to contribute. Guys on the project good to work with, even if they strict about quality.

from winformscominterop.

kant2002 avatar kant2002 commented on August 15, 2024

Latest WinForms in .NET 7 will have a fix. It is not possible to have fix in .NET 6 so I will close issue.

from winformscominterop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.