GithubHelp home page GithubHelp logo

kant2002 / winformscominterop Goto Github PK

View Code? Open in Web Editor NEW
211.0 211.0 30.0 773 KB

ComWrappers required to run NativeAOT and WinForms

License: MIT License

C# 100.00%
aot corert csharp-sourcegenerator nativeaot winforms

winformscominterop's Introduction

ComWrappers required to run NativeAOT and WinForms

This repository has ComWrappers implementation for WinForms. In additional to that, it allow use WinForms and NativeAOT and R2R with trimming together.

Getting started

Just add WinFormsComInterop to your project.

dotnet add package WinFormsComInterop

Then to your Program.cs add following line

ComWrappers.RegisterForMarshalling(WinFormsComInterop.WinFormsComWrappers.Instance);

And modify project file to enable NativeAOT

<PublishAot>true</PublishAot>
<_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>

If you application will works with this ComWrappers implementation, then most likely it would work with NativeAOT.

If you are using WebView2 using Microsoft.Web.WebView2.Core package, then use

ComWrappers.RegisterForMarshalling(WinFormsComInterop.WebView2.WebView2ComWrapper.Instance);

Note, that it does not working for new WebView2 as of .NET 8, please file and issue if you need it, I'll prioritize.

Also

  1. Add <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1462.37" /> as depedency. This library would work only starting from this version of WebView2 package.
  2. Add RD.xml file from https://github.com/kant2002/RdXmlLibrary/blob/main/Microsoft.AspNetCore.Components.Web.rd.xml to project
  3. Add <RdXmlFile Include="Microsoft.AspNetCore.Components.Web.rd.xml" /> to project file
  4. Make sure that RootComponets are added to you app-specific rd.xml
<?xml version="1.0" encoding="utf-8" ?>
<Directives>
  <Application>
    <Assembly Name="YourAppAssembly" Dynamic="Required All">
      <Type Name="YourAppAssembly.YourRootComponent" Dynamic="Required All" />
    </Assembly>
  </Application>
</Directives>

Testing technology

Test that normal CoreCLR works

dotnet run --project samples\SampleWindowsForms\SampleWindowsForms.csproj
dotnet run --project experiments\WpfTestBed\WpfTestBed.csproj
dotnet run --project experiments\WinUITestBed\WinUITestBed\WinUITestBed.csproj
dotnet run --project experiments\WinUIUWP\WinUIUWP.csproj

NativeAOT

Test that NativeAOT works. Run commands in x64 developer tools.

WinForms

dotnet publish -r win-x64 samples\SampleWindowsForms\SampleWindowsForms.csproj
"samples\SampleWindowsForms\bin\x64\Debug\net6.0-windows\win-x64\publish\SampleWindowsForms.exe"

Below are experimental projects. They are need additional work.

WPF

dotnet publish -r win-x64 experiments\WpfTestBed\WpfTestBed.csproj -p:GenerateWPF=true

blocked by #30

WinUI

dotnet publish -r win10-x64 experiments\WinUITestBed\WinUITestBed\WinUITestBed.csproj

Classic UWP project

dotnet publish -r win-x64 experiments\WinUIUWP\WinUIUWP.csproj

does not working due to this error

experiments\WinUIUWP\WinUIUWP.csproj : error MSB4057: The target "Restore" does not exist in the project.

For brave souls

Mostly notes for me, but maybe somebody would like to hack.

Build NativeAOT.

Modify nuget.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <!--Locally built version of NativeAOT -->
    <add key="ILC" value="c:\runtimelab\artifacts\packages\Debug\Shipping\" />
    <!--To use daily builds of runtime -->
    <add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
  </packageSources>
</configuration>

Restore packages to local folder to not pollute global Nuget cache. You will build NativAOT a lot.

dotnet restore -r win-x64 --packages packages

Then publish applications using regular workflow described above.

Additional reading

Design of future stubs in Runtime

winformscominterop's People

Contributors

fornever avatar kant2002 avatar wjk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

winformscominterop's Issues

DragDrop stop working

DragDrop\DragEnter stop working after add ComWrappers.RegisterForMarshalling(WinFormsComInterop.WinFormsComWrappers.Instance)
(Framework.Net 5.0-6.0\AOT)

Notice: Yes, It fix com wrapper error in AOT, but drag and drop events on form, controls stop work (except mouse click, etc)

Maybe any tips?

Thx

Can not save Bitmap to MemoryStream

Repro
var img = new Bitmap(128, 128);
using var ms = new MemoryStream();
img.Save(ms, ImageFormat.Png);
StackTrace
at WinFormsComInterop.WinFormsComWrappers.ComputeVtables(Object, CreateComInterfaceFlags, Int32&) + 0x1af
at System.Runtime.InteropServices.ComWrappers.CreateCCW(Object, CreateComInterfaceFlags) + 0x39
at System.Runtime.InteropServices.ComWrappers.<>c__DisplayClass14_0.b__0(Object) + 0x1c
at System.Runtime.CompilerServices.ConditionalWeakTable2.GetValueLocked(TKey, ConditionalWeakTable2.CreateValueCallback) + 0x2d
at System.Runtime.CompilerServices.ConditionalWeakTable2.GetValue(TKey, ConditionalWeakTable2.CreateValueCallback) + 0x3e
at System.Runtime.InteropServices.ComWrappers.GetOrCreateComInterfaceForObject(Object, CreateComInterfaceFlags) + 0xa8
at System.Runtime.InteropServices.ComWrappers.ComInterfaceForObject(Object, Guid) + 0xe
at System.Drawing.SafeNativeMethods.Gdip.GdipSaveImageToStream(HandleRef, Interop.Ole32.IStream, Guid&, HandleRef) + 0xbd
at System.Drawing.Image.Save(Stream, ImageCodecInfo, EncoderParameters) + 0x144
at Test.Program.Main() + 0x8f

.NET 8.0. "Failed to launch design tools server process"

Hi.
I'm creating a Windows Forms .NET 8.0 project.
Then "dotnet add package WinFormsComInterop".
After adding lines

PublishAot...
_SuppressWinFormsTrimError...

an error appears, the form does not load, the Toolbox is empty.
There was no such error in the .NET 7.0 project.

Visual Studio 2022, version 17.8.3.

Буфер обмена04_2
Буфер обмена04

Failed to load assembly 'Microsoft.Web.WebView2.WinForms.WebView2

I followed the instructions in the README but the published Native AOT fails for WebView2. I installed it via Nuget, why cant it find it when Publishing ? Works without publishing fine


Failed to load assembly 'Microsoft.Web.WebView2.WinForms.WebView2'
1>Internal.TypeSystem.TypeSystemException+FileNotFoundException: Failed to load assembly 'Microsoft.Web.WebView2.WinForms.WebView2'
1> at Internal.TypeSystem.ThrowHelper.ThrowFileNotFoundException(ExceptionStringID, String) in //src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs:line 35
1> at ILCompiler.CompilerTypeSystemContext.GetModuleForSimpleName(String, Boolean ) in /
/src/coreclr/tools/Common/Compiler/CompilerTypeSystemContext.cs:line 121
1> at ILCompiler.RdXmlRootProvider.ProcessAssemblyDirective(IRootingServiceProvider, XElement) in //src/coreclr/tools/aot/ILCompiler/RdXmlRootProvider.cs:line 62
1> at ILCompiler.RdXmlRootProvider.AddCompilationRoots(IRootingServiceProvider) in /
/src/coreclr/tools/aot/ILCompiler/RdXmlRootProvider.cs:line 47
1> at ILCompiler.Compilation..ctor(DependencyAnalyzerBase1, NodeFactory, IEnumerable1, ILProvider, DebugInformationProvider, DevirtualizationManager, IInliningPolicy, Logger) in //src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 64
1> at ILCompiler.ILScannerBuilder.ToILScanner() in /
/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs:line 83
1> at ILCompiler.Program.g__RunScanner|73_4(<>c__DisplayClass73_0&) in //src/coreclr/tools/aot/ILCompiler/Program.cs:line 884
1> at ILCompiler.Program.Run(String[]) in /
/src/coreclr/tools/aot/ILCompiler/Program.cs:line 866
1> at ILCompiler.Program.Main(String[]) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 1150

RichTextBox throw exception

Following exception on creation

System.ArgumentNullException: Value cannot be null. Parameter name: pUnk
   at System.Runtime.InteropServices.Marshal.Release(IntPtr) + 0x65
   at System.Windows.Forms.RichTextBox.UpdateOleCallback() + 0x161
   at System.Windows.Forms.RichTextBox.OnHandleCreated(EventArgs) + 0x36d
   at System.Windows.Forms.Control.WmCreate(Message&) + 0x82

Exception when interface does not supported.

at System.Diagnostics.Debug.Fail(String, String) + 0x21
  at System.Diagnostics.Debug.Assert(Boolean, String, String) + 0x1b
  at System.Diagnostics.Debug.Assert(Boolean) + 0x1a
  at System.Runtime.InteropServices.ComWrappers.ManagedObjectWrapper.Release() + 0x17
  at System.Runtime.InteropServices.ComWrappers.IUnknown_Release(IntPtr) + 0x1f
  at System.Runtime.InteropServices.Marshal.Release(IntPtr) + 0x39
  at System.Runtime.InteropServices.ComWrappers.ComInterfaceForObject(Object, Guid) + 0x2c
  at Internal.Runtime.CompilerHelpers.InteropHelpers.ConvertManagedComInterfaceToNative(Object, Guid) + 0x1a
  at Interop.UiaCore.UiaRaiseAutomationPropertyChangedEvent(Interop.UiaCore.IRawElementProviderSimple, Interop.UiaCore.UIA, Object, Object) + 0xb0
  at System.Windows.Forms.AccessibleObject.RaiseAutomationPropertyChangedEvent(Interop.UiaCore.UIA, Object, Object) + 0x35
  at System.Windows.Forms.Control.ControlAccessibleObject.RaiseAutomationPropertyChangedEvent(Interop.UiaCore.UIA, Object, Object) + 0x21
  at System.Windows.Forms.Button.OnClick(EventArgs) + 0x9f
  at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs) + 0xae
  at System.Windows.Forms.Control.WmMouseUp(Message&, MouseButtons, Int32) + 0x2dc
  at System.Windows.Forms.Control.WndProc(Message&) + 0x677
  at System.Windows.Forms.ButtonBase.WndProc(Message&) + 0x168
  at System.Windows.Forms.NativeWindow.Callback(IntPtr, Interop.User32.WM, IntPtr, IntPtr) + 0x70
  at RibbonDemo2!<BaseAddress>+0xea906a
  at Interop.User32.DispatchMessageW(Interop.User32.MSG&) + 0x44
  at System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(UIntPtr, Interop.Mso.msoloop, Void*) + 0x25b
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Interop.Mso.msoloop, ApplicationContext) + 0x261
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Interop.Mso.msoloop, ApplicationContext) + 0x3e
  at System.Windows.Forms.Form.ShowDialog(IWin32Window) + 0x22b
  at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception) + 0xa7
  at System.Windows.Forms.NativeWindow.Callback(IntPtr, Interop.User32.WM, IntPtr, IntPtr) + 0xdd
  at System.Runtime.EH.DispatchEx(StackFrameIterator&, EH.ExInfo&, UInt32) + 0x368
  at System.Runtime.EH.RhThrowEx(Object, EH.ExInfo&) + 0x59
  at RibbonDemo2!<BaseAddress>+0xea906a
  at Interop.User32.CreateWindowExW(Interop.User32.WS_EX, Char*, String, Interop.User32.WS, Int32, Int32, Int32, Int32, IntPtr, IntPtr, IntPtr, Object) + 0x13d
  at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams) + 0x15c
  at System.Windows.Forms.Control.CreateHandle() + 0x11e
  at System.Windows.Forms.Control.get_Handle() + 0x48
  at System.Windows.Forms.Control.CreateGraphics() + 0x1e
  at System.Windows.Forms.RibbonOrbDropDown.UpdateRegions() + 0x6b
  at System.Windows.Forms.ToolStripDropDown.SetVisibleCore(Boolean) + 0x101
  at System.Windows.Forms.RibbonPopup.Show(Point) + 0x3b4
  at System.Windows.Forms.Ribbon.ShowOrbDropDown() + 0x1f0
  at System.Windows.Forms.Ribbon.OnOrbClicked(EventArgs) + 0x2d
  at System.Windows.Forms.Ribbon.OnMouseDown(MouseEventArgs) + 0xaa
  at System.Windows.Forms.Control.WndProc(Message&) + 0x65b
  at System.Windows.Forms.Ribbon.WndProc(Message&) + 0x473
  at System.Windows.Forms.NativeWindow.Callback(IntPtr, Interop.User32.WM, IntPtr, IntPtr) + 0x70
  at RibbonDemo2!<BaseAddress>+0xea906a
  at Interop.User32.DispatchMessageW(Interop.User32.MSG&) + 0x44
  at System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(UIntPtr, Interop.Mso.msoloop, Void*) + 0x25b
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Interop.Mso.msoloop, ApplicationContext) + 0x261
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Interop.Mso.msoloop, ApplicationContext) + 0x3e
  at RibbonDemo2!<BaseAddress>+0xec371f

I assume that issue is here https://github.com/dotnet/runtimelab/blob/3c7133f395087dcec000668409aeefb237688378/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.CoreRT.cs#L215-L225

I need AddRef each time then request IUnknown.

OpenFileDialog breaks in net6.0-windows if multiselect=true

Calling this in the Main() entry point of the program

[STAThread]
static void Main(string[] args) {
  System.Runtime.InteropServices.ComWrappers.RegisterForMarshalling(WinFormsComInterop.WinFormsComWrappers.Instance);
  // ...

Breaks the multiselect function of the OpenFileDialog, even in DEBUG builds. Using the following sample code from a Form's main thread, the dialog will not let me click 'open'. Removing the WinFormsComInterop call above, it works fine again. If I disable multiselect, it works with WinFormsComInterop. Even when only selecting 1 file it breaks the dialog.

using var dialog = new System.Windows.Forms.OpenFileDialog() {
    Title = title,
    Filter = filter,
    InitialDirectory = searchDirectory,
    Multiselect = true, // doesn't work with WinFormsComWrappers
    DereferenceLinks = true,
};
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
    return dialog.FileNames;
}

using a net6-windows target:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
  <TargetFrameworks>net6.0-windows</TargetFrameworks>
  <OutputType>Exe</OutputType>
  <LangVersion>10.0</LangVersion>

  <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
  <UseWindowsForms>true</UseWindowsForms>
  <ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
  <ApplicationHighDpiMode>true</ApplicationHighDpiMode>

  <PlatformTarget>x64</PlatformTarget>
  <Platforms>AnyCPU;x64;x86</Platforms>
  <Configurations>Debug;Release</Configurations>
  <Prefer32Bit>false</Prefer32Bit>
<!-- ... -->

WinFormsComInterop.SourceGenerator does not work with Type StringBuilder

WinFormsComInterop.SourceGenerator does not work with argument type StringBuilder.

Test interface:
Interface IQueryAssociations

https://www.pinvoke.net/default.aspx/shlwapi/AssocCreate.html
https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nn-shlwapi-iqueryassociations

In method:
void GetString(
[In] ASSOCF flags,
[In] ASSOCSTR str,
[In, MarshalAs(UnmanagedType.LPWStr)] string pwszExtra,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwszOut,
[In, Out] ref int pcchOut);

It has a StringBuilder argument type. If you compile this interface, Visual Studio will prompt an error:
Error CS8894 Cannot use 'StringBuilder' as a parameter type on a method attributed with 'UnmanagedCallersOnly'.

SourceGenerator doesn’t run at design time in its own solution

While working on #8, I have discovered that, for some reason, the source generator does not run when it is resolved as a project reference during design-time builds. Its entry under the Dependencies node states “This generator is not generating files.” As such, the files in the WinFormsComInterop project display spurious errors about missing types and members. Note that the source generator does run correctly when the solution is built.

Support for DragDrop is incomplete

Hi,
After testing, the DragOver event can be triggered. But e.Data.GetDataPresent() has no effect,
DragDrop and DragEnter events are never triggered.

This project has not been updated for 4 months. I don't know whether it will continue.

dont working with net8

errors when build and dont have in net7

ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.CreateObject(native int,Cr
eateObjectFlags)' will always throw because: Failed to load type 'IOleWindow' from assembly 'Syste
m.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.ComputeVtables(object,Crea
teComInterfaceFlags,int32&)' will always throw because: Failed to load type 'IDropTarget' from ass
embly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561
934e089'
ILC: Method '[PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFacto
ryCoClass..ctor()' will always throw because: Invalid IL or CLR metadata in 'Void SpellCheckerFact
oryCoClass..ctor()'
ILC: Method '[PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFacto
ryCoClass.UnregisterUserDictionary(string,string)' will always throw because: Invalid IL or CLR me
tadata in 'Void SpellCheckerFactoryCoClass.UnregisterUserDictionary(System.String, System.String)'
ILC: Method '[PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFacto
ryCoClass.RegisterUserDictionary(string,string)' will always throw because: Invalid IL or CLR meta
data in 'Void SpellCheckerFactoryCoClass.RegisterUserDictionary(System.String, System.String)'
ILC: Method '[PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFacto
ryCoClass.CreateSpellChecker(string)' will always throw because: Invalid IL or CLR metadata in 'IS
pellChecker SpellCheckerFactoryCoClass.CreateSpellChecker(System.String)'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.CreatePrimitivesIStreamPro
xyVtbl(native int&)' will always throw because: Failed to load type 'STATSTG' from assembly 'Syste
m.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.CreatePrimitivesIStoragePr
oxyVtbl(native int&)' will always throw because: Failed to load type 'STATSTG' from assembly 'Syst
em.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.CreatePrimitivesIRichEditO
leCallbackProxyVtbl(native int&)' will always throw because: Failed to load type 'CHARRANGE' from
assembly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c
561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.CreatePrimitivesIOleInPlac
eSiteProxyVtbl(native int&)' will always throw because: Failed to load type 'RECT' from assembly '
System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.CreatePrimitivesIDocHostUI
HandlerProxyVtbl(native int&)' will always throw because: Failed to load type 'RECT' from assembly
'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e0
89'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.CreatePrimitivesIOleContro
lSiteProxyVtbl(native int&)' will always throw because: Failed to load type 'MSG' from assembly 'S
ystem.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.CreatePrimitivesIOleInPlac
eFrameProxyVtbl(native int&)' will always throw because: Failed to load type 'RECT' from assembly
'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08
9'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.CreatePrimitivesIFileDialo
gEventsProxyVtbl(native int&)' will always throw because: Failed to load type 'FDESVR' from assemb
ly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934
e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIOleContainerProxy.LockContainer(nat
ive int,int32)' will always throw because: Failed to load type 'IOleContainer' from assembly 'Syst
em.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIOleContainerProxy.EnumObjects(nativ
e int,int32,native int*)' will always throw because: Failed to load type 'IOleContainer' from asse
mbly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5619
34e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIOleContainerProxy.ParseDisplayName(
native int,native int,native int,uint32*,native int*)' will always throw because: Failed to load t
ype 'IOleContainer' from assembly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutr
al, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIOleClientSiteProxy.RequestNewObject
Layout(native int)' will always throw because: Failed to load type 'IOleClientSite' from assembly
'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08
9'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIOleClientSiteProxy.OnShowWindow(nat
ive int,int32)' will always throw because: Failed to load type 'IOleClientSite' from assembly 'Sys
tem.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIOleClientSiteProxy.ShowObject(nativ
e int)' will always throw because: Failed to load type 'IOleClientSite' from assembly 'System.Wind
ows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIOleClientSiteProxy.GetContainer(nat
ive int,native int*)' will always throw because: Failed to load type 'IOleClientSite' from assembl
y 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e
089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIOleClientSiteProxy.GetMoniker(nativ
e int,int32,int32,native int*)' will always throw because: Failed to load type 'IOleClientSite' fr
om assembly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77
a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIOleClientSiteProxy.SaveObject(nativ
e int)' will always throw because: Failed to load type 'IOleClientSite' from assembly 'System.Wind
ows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesISimpleFrameSiteProxy.PostMessageFil
ter(native int,native int,uint32,native int,native int,native int*,uint32)' will always throw beca
use: Failed to load type 'ISimpleFrameSite' from assembly 'System.Windows.Forms.Primitives, Versio
n=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesISimpleFrameSiteProxy.PreMessageFilt
er(native int,native int,uint32,native int,native int,native int*,uint32*)' will always throw beca
use: Failed to load type 'ISimpleFrameSite' from assembly 'System.Windows.Forms.Primitives, Versio
n=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIPropertyNotifySinkProxy.OnRequestEd
it(native int,int32)' will always throw because: Failed to load type 'IPropertyNotifySink' from as
sembly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56
1934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIPropertyNotifySinkProxy.OnChanged(n
ative int,int32)' will always throw because: Failed to load type 'IPropertyNotifySink' from assemb
ly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934
e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIDropTargetProxy.Drop(native int,nat
ive int,uint32,Point,uint32*)' will always throw because: Failed to load type 'IDropTarget' from a
ssembly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5
61934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIDropTargetProxy.DragLeave(native in
t)' will always throw because: Failed to load type 'IDropTarget' from assembly 'System.Windows.For
ms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIDropTargetProxy.DragOver(native int
,uint32,Point,uint32*)' will always throw because: Failed to load type 'IDropTarget' from assembly
'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e0
89'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIDropTargetProxy.DragEnter(native in
t,native int,uint32,Point,uint32*)' will always throw because: Failed to load type 'IDropTarget' f
rom assembly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b7
7a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.PrimitivesIServiceProviderProxy.QueryService(n
ative int,Guid*,Guid*,native int*)' will always throw because: Failed to load type 'IServiceProvid
er' from assembly 'System.Windows.Forms.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyTok
en=b77a5c561934e089'
ILC: Method '[WinFormsComInterop]WinFormsComInterop.MarshalSupport.GetIUnknownForObject(object)' w
ill always throw because: Failed to load type 'IOleWindow' from assembly 'System.Windows.Forms.Pri
mitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ILC: Method '[System.DirectoryServices]System.DirectoryServices.UnsafeNativeMethods+PropertyEntry.
.ctor()' will always throw because: Invalid IL or CLR metadata in 'Void PropertyEntry..ctor()'
ILC: Method '[System.DirectoryServices]System.DirectoryServices.UnsafeNativeMethods+PropertyValue.
.ctor()' will always throw because: Invalid IL or CLR metadata in 'Void PropertyValue..ctor()'
ILC: Method '[PresentationCore]MS.Internal.AppModel.CustomCredentialPolicy+InternetSecurityManager
..ctor()' will always throw because: Invalid IL or CLR metadata in 'Void InternetSecurityManager..
ctor()'
ILC: Method '[WindowsBase]MS.Internal.Security.AttachmentService+AttachmentServices..ctor()' will
always throw because: Invalid IL or CLR metadata in 'Void AttachmentServices..ctor()'

Use .ico file for winform

image
I have added an .ico file to my winform. When I use 'dotnet run', it's still normal, but when I use 'dotnet publish -r win-x64', when I run the exe file, I get an error as shown in the picture.

How to publish AOT?

If I publish the sample app, I still get a managed .NET dll file with an executable host file and all the .NET runtime dll files. But when I publish a console project with AOT I get a single unmanaged executable. This is what I've expected for Winforms as well.

I used this command dotnet publish -r win-x64 and then went to the publish folder.

image

Using System.Windows.Forms.Integration.ElementHost.ElementHost in Avalonia crash

Using System.Windows.Forms.Integration.ElementHost.ElementHost in Avalonia

在 WinFormsComInterop.WinFormsComWrappers.ComputeVtables(Object obj, CreateComInterfaceFlags flags, Int32& count)
在 System.StubHelpers.InterfaceMarshaler.ConvertToNative(Object objSrc, IntPtr itfMT, IntPtr classMT, Int32 flags)
在 MS.Win32.UnsafeNativeMethods.RegisterDragDrop(HandleRef hwnd, IOleDropTarget target)
在 System.Windows.DragDrop.RegisterDropTarget(IntPtr windowHandle)
在 System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters)
在 System.Windows.Forms.Integration.ElementHost.b__54_0()
在 System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
在 System.Windows.Threading.Dispatcher.Invoke(Action callback)
在 System.Windows.Forms.Integration.ElementHost.OnHandleCreated(EventArgs e)
在 System.Windows.Forms.Control.WmCreate(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

dotnet add package WinFormsComInterop failed

execute " dotnet add package WinFormsComInterop "
says:

info : NotFound https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6
d082ae6d/_packaging/fe324174-469a-4296-a9cb-1fd885bb6f2b/nuget/v3/registrations2
-semver2/winformscominterop/index.json 1726 毫秒
info : GET https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082a
e6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/registrations2-semv
er2/winformscominterop/index.json
info : GET https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082a
e6d/_packaging/fe324174-469a-4296-a9cb-1fd885bb6f2b/nuget/v3/registrations2-semv
er2/winformscominterop/index.json
info : NotFound https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6
d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/registrations2
-semver2/winformscominterop/index.json 512 毫秒
info : NotFound https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6
d082ae6d/_packaging/fe324174-469a-4296-a9cb-1fd885bb6f2b/nuget/v3/registrations2
-semver2/winformscominterop/index.json 996 毫秒

DragAndDrop support

In RibbonDemo2 application

System.InvalidOperationException: DragDrop registration did not succeed.
 ---> System.InvalidCastException: Specified cast is not valid.
   at System.Runtime.InteropServices.ComWrappers.ComInterfaceForObject(Object, Guid) + 0x5b
   at Interop.Ole32.RegisterDragDrop(IntPtr, Interop.Ole32.IDropTarget) + 0xa0
   at Interop.Ole32.RegisterDragDrop(IHandle, Interop.Ole32.IDropTarget) + 0x2d
   at System.Windows.Forms.Control.SetAcceptDrops(Boolean) + 0xa9
   

Failed to compile with NativeAOT .NET 7.0

Hey,

I was trying to use it on a .NET 7 + NativeAOT and dotnet publish generates the following warning:

ILC: Method '[SimpleProgramChange]SimpleProgramChange.SimpleProgramChangeController.CreateView()' will always throw because: Failed to load assembly 'System.Windows.Forms'

And it crashes at runtime indeed.

I had also to remove the initialization of WinFormsComInterop (Package 0.3.2) as I saw it here

Any clue?

Check for return value after call in out parameters

HRESULT Shell32.IFileOpenDialog.GetSelectedItems(out Shell32.IShellItemArray ppsai)
{
    var comDispatch = (System.IntPtr*)thisPtr;
    var vtbl = (System.IntPtr*)comDispatch[0];
    System.IntPtr local_0;
    int retVal;
    retVal = ((delegate* unmanaged<System.IntPtr, System.IntPtr*, int>)vtbl[28])(thisPtr, &local_0);
    ppsai = local_0 == System.IntPtr.Zero ? null : (Shell32.IShellItemArray)Marshal.GetObjectForIUnknown(local_0);
    return (HRESULT)retVal;
}

retVal should be checked before calling Marshal.GetObjectForIUnknown

Incorrect slot numbers used when method follows a read-only property

Consider the following code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Repro
{
    [Guid("95627282-E95D-4B4B-AD4E-94E440D2A92C"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    interface ISayHello
    {
        int HelloCount { get; }
        void SayHello(string toWhom);
    }
}

When I add this code to my project and add the RuntimeCallableAttribute, the source generator uses a slot number of 3 for HelloCount (as it should), but a slot number of 5 for SayHello. This will more-or-less guarantee an AccessViolationException whenever you call SayHello. I don’t know why this happens (since the code that increments the slot number for a setter method is skipped if there is none). I am using SourceGenerator version 0.2.8. Thanks for looking into this for me!

how to use from simple winform demo ,i run is throw exception

1>ILC: Method '[IPRedirect]IPRedirect.Program.Main()' will always throw because: Failed to load assembly 'System.Windows.Forms'
1>"C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.36.32522\bin\Hostx64\x64\link.exe" @"obj\Release\net7.0-windows\win-x64\native\link.rsp

but use rd.xml descript it,throw some exception

winform net7 aot ,Close() application execution error

System.DllNotFoundException: Unable to load DLL 'vcruntime140_cor3.dll' or one of its dependencies: The specified module could not be found.
at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0x79
at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0xe4
at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x2f
at .__std_type_info_destroy_list(__type_info_node*) + 0x2d
at .__scrt_uninitialize_type_info() + 0x29
at ._app_exit_callback() + 0x148
at .ModuleUninitializer.SingletonDomainUnload(Object source, EventArgs arguments) + 0xa4
at Client!+0x18496f6
at System.Environment.Exit(Int32) + 0x29
at Launcher.AMain.AMain_FormClosed(Object sender, FormClosedEventArgs e) + 0x5c
at System.Windows.Forms.Form.WmClose(Message&) + 0x462
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Interop.User32.WM msg, IntPtr wparam, IntPtr lparam) + 0x70

Crashes with net6-windows and WinFormsComInterop >= 0.4

Application works perfectly with WinFormsComInterop 0.3.2, using net6.0-windows as the target and the HIC.System.Windows.Forms.DataVisualization package, which is a small fork from dotnet.

These are from a debug build, no trimming or AOT.

0.4.2: Opens, but hard crash after closing the file picker dialog. The exception code and offset for ntdll are the same every time.

The program has exited with code 3221226356 (0xc0000374).
---
Faulting application name: myprogram.exe, version: 1.2.0.0, time stamp: 0x6387d353
Faulting module name: ntdll.dll, version: 10.0.19041.2130, time stamp: 0xb5ced1c6
Exception code: 0xc0000374
Fault offset: 0x00000000000ff6a9
Faulting process id: 0x86c
Faulting application start time: 0x01d92ae651cffe54
Faulting application path: myprogram.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 7c249671-d100-4788-9c25-c0f824c6c7fc
Faulting package full name: 
Faulting package-relative application ID: 

0.4.1, 0.4.0: Missing library when trying to open the system file picker dialog

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.WebView2.Core, Version=1.0.1370.28, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'Microsoft.Web.WebView2.Core, Version=1.0.1370.28, Culture=neutral, PublicKeyToken=null'
   at MarshalSupport.GetIUnknownForObject(Object value)
   at WinFormsComInterop.IFileOpenDialogWrapper.primitives::Interop.Shell32.IFileDialog.Advise(IFileDialogEvents pfde, UInt32& pdwCookie)
   at System.Windows.Forms.FileDialog.TryRunDialogVista(IntPtr hWndOwner, Boolean& returnValue)
   at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
   at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.CommonDialog.ShowDialog()

Support ManagementObjectSearcher Class

Many useful hardware information in the system can be queried through ManagementObjectSearcher class, but WinFormsComInterop cannot support it at present.

https://learn.microsoft.com/en-us/dotnet/api/system.management.managementobjectsearcher

About ManagementObjectSearcher Class:

Retrieves a collection of management objects based on a specified query. This class is one of the more commonly used entry points to retrieving management information. For example, it can be used to enumerate all disk drives, network adapters, processes and many more management objects on a system, or to query for all network connections that are up, services that are paused, and so on.

Doesn't work with WebView2

Hi! This repo seems really useful to get some WinForms apps working with NativeAOT, however it seems to have some issues with WebView2. Using this repo removed some of the Com Wrappers exceptions but now it has a different one which I think is related to this repo:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NotImplementedException: The method or operation is not implemented.
   at WinFormsComInterop.WinFormsComWrappers.ComputeVtables(Object, CreateComInterfaceFlags, Int32&) + 0x1af
   at System.Runtime.InteropServices.ComWrappers.CreateCCW(Object, CreateComInterfaceFlags) + 0x39
   at System.Runtime.InteropServices.ComWrappers.<>c__DisplayClass25_0.<GetOrCreateComInterfaceForObject>b__0(Object) + 0x1c
   at System.Runtime.CompilerServices.ConditionalWeakTable`2.GetValueLocked(TKey, ConditionalWeakTable`2.CreateValueCallback) + 0x26
   at System.Runtime.CompilerServices.ConditionalWeakTable`2.GetValue(TKey, ConditionalWeakTable`2.CreateValueCallback) + 0x3e
   at System.Runtime.InteropServices.ComWrappers.GetOrCreateComInterfaceForObject(Object, CreateComInterfaceFlags) + 0xa8
   at System.Runtime.InteropServices.ComWrappers.ComInterfaceForObject(Object, Guid) + 0xe
   at Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateCoreWebView2EnvironmentWithOptions(String, String, ICoreWebView2EnvironmentOptions, ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler) + 0xd7
   at Microsoft.Web.WebView2.Core.CoreWebView2Environment.<CreateAsync>d__3.MoveNext() + 0xd0
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x20
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xb9
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x44
   at Renderer.Windows.RuntimeWindow.<<-ctor>b__4_0>d.MoveNext() + 0xdb
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x20
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object) + 0x28
   at Renderer!<BaseAddress>+0xe709af
   at System.InvokeUtils.CallDynamicInvokeMethod(Object, IntPtr, IntPtr, IntPtr, Object, Object[], BinderBundle, Boolean, Boolean) + 0x113


************** Loaded Assemblies **************
System.ComponentModel.TypeConverter
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Diagnostics.DiagnosticSource
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.ObjectModel
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Private.Uri
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.IO.Compression
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.NetworkInformation
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Windows.Forms.Primitives
    Assembly Version: 6.0.1.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Collections
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Drawing.Common
    Assembly Version: 6.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Design
    Assembly Version: 6.0.1.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.ComponentModel.EventBasedAsync
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.Security
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Private.Xml
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
Renderer
    Assembly Version: 1.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.Requests
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Runtime.CompilerServices.Unsafe
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Collections.Specialized
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.ServicePoint
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Windows.Forms.Design
    Assembly Version: 6.0.1.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Linq.Expressions
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Security.Cryptography.Cng
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Runtime.Numerics
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
Microsoft.Web.WebView2.Core
    Assembly Version: 1.0.1072.54
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Private.Interop
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Drawing.Primitives
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Configuration.ConfigurationManager
    Assembly Version: 6.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Diagnostics.TraceSource
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Security.Cryptography.X509Certificates
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.ComponentModel.Primitives
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Runtime.Serialization.Formatters
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Private.CoreLib
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Text.RegularExpressions
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Collections.NonGeneric
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.Quic
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Threading
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.IO.Compression.Brotli
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Linq
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
WinFormsComInterop
    Assembly Version: 0.2.9.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Text.Encoding.CodePages
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Security.Cryptography.Csp
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Threading.Channels
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.Sockets
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Diagnostics.Process
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Windows.Forms
    Assembly Version: 6.0.1.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Security.Principal.Windows
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.Http
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
Microsoft.Win32.Registry
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
Microsoft.Win32.SystemEvents
    Assembly Version: 6.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Security.Cryptography
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.Primitives
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Security.Claims
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Windows.Extensions
    Assembly Version: 6.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Private.Reflection.Execution
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.WebHeaderCollection
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Runtime.InteropServices
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Resources.Writer
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Diagnostics.FileVersionInfo
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.CodeDom
    Assembly Version: 6.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Private.TypeLoader
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Collections.Concurrent
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.ComponentModel
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Private.Reflection.Core
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.NameResolution
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Net.WebClient
    Assembly Version: 7.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: n/a
    CodeBase: 
----------------------------------------
Microsoft.Web.WebView2.WinForms
    Assembly Version: 1.0.1072.54
    Win32 Version: n/a
    CodeBase: 
----------------------------------------

************** JIT Debugging **************

Could this be solved in the near future? Otherwise, is there a way to prod MS into giving NativeAOT more love/attention? It's very discouraging to spend time developing an app just to see it disassembled in a couple seconds with ILSpy. At least native code provides a layer of protection where you'd need to know assembler, and it's harder (but not impossible, I know) to alter.

Thanks!

WPF support

So far with .NET 7 I can list following issues

  1. Output form ILC. CoClass usage should be replaced with ComWrappers
  ILC: Ignoring unresolved method [PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFactoryCoClass.CreateSpellChecker(string), because: Invalid IL or CLR metadata in 'ISpellChecker SpellCheckerFactoryCoClass.CreateSpellChecker(System.String)'
  ILC: Ignoring unresolved method [PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFactoryCoClass.IsSupported(string), because: Invalid IL or CLR metadata in 'Int32 SpellCheckerFactoryCoClass.IsSupported(System.String)'
  ILC: Ignoring unresolved method [PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFactoryCoClass.RegisterUserDictionary(string,string), because: Invalid IL or CLR metadata in 'Void SpellCheckerFactoryCoClass.RegisterUserDictionary(System.String, System.String)'
  ILC: Ignoring unresolved method [PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFactoryCoClass.UnregisterUserDictionary(string,string), because: Invalid IL or CLR metadata in 'Void SpellCheckerFactoryCoClass.UnregisterUserDictionary(System.String, System.String)'
  ILC: Ignoring unresolved method [PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFactoryCoClass.get_SupportedLanguages(), because: Invalid IL or CLR metadata in 'IEnumString SpellCheckerFactoryCoClass.get_SupportedLanguages()'
  ILC: Ignoring unresolved method [PresentationFramework]System.Windows.Documents.MsSpellCheckLib.RCW+SpellCheckerFactoryCoClass..ctor(), because: Invalid IL or CLR metadata in 'Void SpellCheckerFactoryCoClass..ctor()'
  ILC: Ignoring unresolved method [PresentationCore]MS.Internal.AppModel.CustomCredentialPolicy+InternetSecurityManager..ctor(), because: Invalid IL or CLR metadata in 'Void InternetSecurityManager..ctor()'
  ILC: Ignoring unresolved method [System.DirectoryServices]System.DirectoryServices.Interop.UnsafeNativeMethods+PropertyValue..ctor(), because: Invalid IL or CLR metadata in 'Void PropertyValue..ctor()'
  ILC: Ignoring unresolved method [System.DirectoryServices]System.DirectoryServices.Interop.UnsafeNativeMethods+PropertyEntry..ctor(), because: Invalid IL or CLR metadata in 'Void PropertyEntry..ctor()'
  ILC: Ignoring unresolved method [ReachFramework]System.Windows.Xps.Serialization.RCW.XpsOMThumbnailGeneratorClass.GenerateThumbnail(IXpsOMPage,XPS_IMAGE_TYPE,XPS_THUMBNAIL_SIZE,IOpcPartUri), because: Invalid IL or CLR metadata in 'System.Windows.Xps.Serialization.RCW.IXpsOMImageResource System.Windows.Xps.Serialization.RCW.XpsOMThumbnailGeneratorClass.GenerateThumbnail(System.Windows.Xps.Serialization.RCW.IXpsOMPage, System.Windows.Xps.Serialization.RCW.XPS_IMAGE_TYPE, System.Windows.Xps.Serialization.RCW.XPS_THUMBNAIL_SIZE, System.Windows.Xps.Serialization.RCW.IOpcPartUri)'
  ILC: Ignoring unresolved method [ReachFramework]System.Windows.Xps.Serialization.RCW.XpsOMThumbnailGeneratorClass..ctor(), because: Invalid IL or CLR metadata in 'Void System.Windows.Xps.Serialization.RCW.XpsOMThumbnailGeneratorClass..ctor()'
  ILC: Ignoring unresolved method [WindowsBase]MS.Internal.Security.AttachmentService+AttachmentServices..ctor(), because: Invalid IL or CLR metadata in 'Void AttachmentServices..ctor()'
  ILC: Ignoring unresolved method [DirectWriteForwarder]<Module>.qsort(void*,uint32,uint32,(*int32)(void*,void*)), because: Vararg call to 'Int32 <Module>._CrtDbgReportW(Int32, Char*, Int32, Char*, Char*)' not supported
  ILC: Ignoring unresolved method [DirectWriteForwarder]<Module>.qsort_s(void*,uint32,uint32,(*int32)(void*,void*,void*),void*), because: Vararg call to 'Int32 <Module>._CrtDbgReportW(Int32, Char*, Int32, Char*, Char*)' not supported
  ILC: Ignoring unresolved method [DirectWriteForwarder]<Module>.bsearch(void*,void*,uint32,uint32,(*int32)(void*,void*)), because: Vararg call to 'Int32 <Module>._CrtDbgReportW(Int32, Char*, Int32, Char*, Char*)' not supported
  ILC: Ignoring unresolved method [DirectWriteForwarder]<Module>.bsearch_s(void*,void*,uint32,uint32,(*int32)(void*,void*,void*),void*), because: Vararg call to 'Int32 <Module>._CrtDbgReportW(Int32, Char*, Int32, Char*, Char*)' not supported
  ILC: Ignoring unresolved method [DirectWriteForwarder]<Module>.std._Iterator_base12._Orphan_me_unlocked_v3(_Iterator_base12*), because: Vararg call to 'Int32 <Module>._CrtDbgReport(Int32, SByte*, Int32, SByte*, SByte*)' not supported
  ILC: Ignoring unresolved method [WinFormsComInterop]WinFormsComInterop.WinFormsComWrappers.ComputeVtables(object,CreateComInterfaceFlags,int32&), because: Failed to load type 'System.Windows.Forms.InternalAccessibleObject' from assembly 'System.Windows.Forms, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
  ILC: Ignoring unresolved method [System.Printing]<Module>.std._Iterator_base12._Orphan_me_unlocked_v3(_Iterator_base12*), because: Vararg call to 'Int32 <Module>._CrtDbgReport(Int32, SByte*, Int32, SByte*, SByte*)' not supported
  ILC: Ignoring unresolved method [PresentationFramework]MS.Internal.AppModel.AppSecurityManager+InternetSecurityManager..ctor(), because: Invalid IL or CLR metadata in 'Void InternetSecurityManager..ctor()'
  1. DirectWriteForwarder crash in main. That is blocker
0:000> kc
 # Call Site
00 WpfTestBed!HndWriteBarrierWorker
01 WpfTestBed!HndWriteBarrier
02 WpfTestBed!HndAssignHandle
03 WpfTestBed!GCHandleManager::StoreObjectInHandle
04 WpfTestBed!S_P_CoreLib_System_Runtime_InteropServices_GCHandle__set_Target
05 WpfTestBed!DirectWriteForwarder__Module___gcroot_System__String_____
06 WpfTestBed!DirectWriteForwarder__Module____CrtImplementationDetails__LanguageSupport_Initialize
07 WpfTestBed!DirectWriteForwarder__Module____cctor
08 WpfTestBed!S_P_CoreLib_Internal_Runtime_CompilerHelpers_StartupCodeHelpers__RunInitializers
09 WpfTestBed!S_P_CoreLib_Internal_Runtime_CompilerHelpers_StartupCodeHelpers__RunModuleInitializers
0a WpfTestBed!WpfTestBed__Module___StartupCodeMain
0b WpfTestBed!wmain
0c WpfTestBed!invoke_main
0d WpfTestBed!__scrt_common_main_seh
0e KERNEL32!BaseThreadInitThunk
0f ntdll!RtlUserThreadStart

.NET 7 issues

Hello,
Thank you for making this great repository!

When using .NET 7 Preview 5, I am experiencing some issues with the SampleWindowsForms project.
It appears in Program.cs, there's a #if disabling ComWrappers when running .NET 7:

#if !NET7_0_OR_GREATER
            ComWrappers.RegisterForMarshalling(WinFormsComInterop.WinFormsComWrappers.Instance);
#endif

It seems disabling ComWrappers causes the error message "Built-in COM has been disabled via a feature switch." on application launch. However, by removing the #if !NET7_0_OR_GREATER statement, this issue goes away. My question is, why disable ComWrappers registration on .NET 7?

The last issue I experience is with the windows forms designer. When double clicking on for example, MainForm.cs, numerous error messages pop up. One of them being "The control System.Windows.Forms.TextBox has thrown an unhandled exception in the designer and has been disabled."
This issue does not appear when running the app normally (via Ctrl + F5), but only in the designer.
I am assuming that this is because when running the app normally, ComWrappers.RegisterForMarshalling is able to be called. However, when in the designer, ComWrappers.RegisterForMarshalling cannot be called.

However, most of the designer works. It's just TextBox, and NumericUpDown that does not work and shows an error.
I was wondering, is there any way around this problem?

Thanks

Windows.Forms.Control.DoDragDrop crashes with ComWrappers

Calling Control.DoDragDrop crashes when it calls into Ole32.DoDragDrop with this call stack:

System.NotImplementedException
  HResult=0x80004001
  Message=The method or operation is not implemented.
  Source=WinFormsComInterop
  StackTrace:
   at WinFormsComInterop.WinFormsComWrappers.ComputeVtables(Object obj, CreateComInterfaceFlags flags, Int32& count)
   at System.StubHelpers.InterfaceMarshaler.ConvertToNative(Object objSrc, IntPtr itfMT, IntPtr classMT, Int32 flags)
   at Interop.Ole32.DoDragDrop(IDataObject pDataObj, IDropSource pDropSource, DROPEFFECT dwOKEffects, DROPEFFECT& pdwEffect)
   at System.Windows.Forms.Control.DoDragDrop(Object data, DragDropEffects allowedEffects, Bitmap dragImage, Point cursorOffset, Boolean useDefaultDragImage) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs:line 5412

Can WinFormsComInterop work with json

I created a winform to upload files to gg drive and got the error "Newtonsoft.Json.JsonSerializationException: Unable to find a
constructor to use for type
Google.Apis.Auth.OAuth2.GoogleClientSecrets. A class should either
have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path "installed', line 2, position 16.
at
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewO
bject(JsonReader, JsonObjectContract, JsonProperty, JsonProperty, String, Boolean&)+0x18f
at
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader, Type, JsonContract, JsonProperty, JsonContainerContract, JsonProperty, Object) + 0x2a4
at
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValuel nternal(JsonReader, Type, JsonContract, JsonProperty, JsonContainerContract, JsonProperty, Object) + 0xa4
at
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(Js
onReader, Type, Boolean)+0x257
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader, Type) + Oxf4
at Google.Apis.Json.NewtonsoftJsonSerializer.DeserializeT 0x92" when building to native code but when running directly on visual studio it's okay! Please help me

Why some conputer run AOT exe show error dialog,but others not?

my computer show error dialog like this,but my another computer not

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NotSupportedException: COM Interop requires ComWrapper instance registered for marshalling.
at System.Runtime.InteropServices.ComWrappers.ComObjectForInterface(IntPtr) + 0x59
at System.Windows.Forms.UnsafeNativeMethods.CreateStdAccessibleObject(HandleRef, Int32, Guid&, Object&) + 0xbb
at System.Windows.Forms.AccessibleObject.UseStdAccessibleObjects(IntPtr, Int32) + 0x4a
at System.Windows.Forms.ButtonBase.ButtonBaseAccessibleObject..ctor(Control) + 0x35
at System.Windows.Forms.Button.CreateAccessibilityInstance() + 0x23
at System.Windows.Forms.Control.get_AccessibilityObject() + 0x60
at System.Windows.Forms.Control.GetAccessibilityObject(Int32 accObjId) + 0x14
at System.Windows.Forms.Control.WmGetObject(Message& m) + 0x84
at System.Windows.Forms.Control.WndProc(Message& m) + 0x141
at System.Windows.Forms.ButtonBase.WndProc(Message& m) + 0x17d
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Interop.User32.WM msg, IntPtr wparam, IntPtr lparam) + 0x70

Working with WMPLib.WindowsMediaPlayer

Hello, is it possible to somehow work with WMPLib.WindowsMediaPlayer ?

https://learn.microsoft.com/en-us/windows/win32/wmp/creating-the-windows-media-player-control-programmatically?redirectedfrom=MSDN
("To create the Windows Media Player control programmatically, you must first add a reference to wmp.dll, which is found in the \Windows\system32 folder. Adding this reference creates WMPLib.dll in your project folder, and a reference to WMPLib appears in Solution Explorer.")

I get an error.

Windows.Forms.Clipboard.ContainsText crashes with ComWrappers

Calling Clipboard.ContainsText() crashes with this call stack:

System.InvalidCastException
  HResult=0x80004002
  Message=Unable to cast object of type 'WinFormsComInterop.IExternalObject' to type 'System.Runtime.InteropServices.ComTypes.IDataObject'.
  Source=System.Private.CoreLib
  StackTrace:
   at System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr& ppUnk, IntPtr itfMT, IntPtr classMT, Int32 flags)
   at Interop.Ole32.OleGetClipboard(IDataObject& data)
   at System.Windows.Forms.Clipboard.GetDataObject(Int32 retryTimes, Int32 retryDelay) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Clipboard.cs:line 146
   at System.Windows.Forms.Clipboard.ContainsText() in /_/src/System.Windows.Forms/src/System/Windows/Forms/Clipboard.cs:line 227

Winforms samples dont compile, dozens of errors

I get dozens of errors like this below. Has this project ever compiled successfully ?

WinFormsComInterop-main\WinFormsComInterop\IAccessibleEnumWrapper.cs(
87,9): error CS0538: 'Accessibility.IAccessible' in explicit interface declaration is not an interface

WinFormsComInterop-main\WinFormsComInterop-main\WinFormsComInterop\IAccessibleEnumWrapper.cs(
95,12): error CS0538: 'Accessibility.IAccessible' in explicit interface declaration is not an interface

ComWrappers crashing with Windows.Forms.Clipboard.SetText and SetDataObject

System.NotImplementedException: The method or operation is not implemented.
at WinFormsComInterop.WinFormsComWrappers.ComputeVtables(Object, CreateComInterfaceFlags, Int32&) + 0x160
at System.Runtime.InteropServices.ComWrappers.CreateCCW(Object, CreateComInterfaceFlags) + 0x36
at System.Runtime.InteropServices.ComWrappers.<>c__DisplayClass25_0.b__0(Object) + 0x1c

BlazorHybrid demo does not work

Copying the full repo and trying to build the BlazorHybrid demo fails with 219 errors. Well happens.

Isolating only the BlazorHybrid demo, removing reference to the project, and adding Nuget WinFormsComInterop (0.4.3) it is finally possible to build. A little bit broken CSS but not a big deal. Commented out /fetchdata is on purpose, I guess, since uncommenting that will crash with the following error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.

But the biggest issue is that it is not possible to publish as a native AOT.
When trying to do either in Visual Studio or with the dotnet command, both fails with an error:

Failed to load type 'BlazorHybrid.Counter' from assembly 'BlazorHybrid, Version=0.4.3.0, Culture=neutral, PublicKeyToken=null'
2> Internal.TypeSystem.TypeSystemException+TypeLoadException: Failed to load type 'BlazorHybrid.Counter' from assembly 'BlazorHybrid, Version=0.4.3.0, Culture=neutral, PublicKeyToken=null'
2>   at Internal.TypeSystem.ThrowHelper.ThrowTypeLoadException(ExceptionStringID, String, String) in /_/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs:line 17
2>   at Internal.TypeSystem.ResolutionFailure.Throw() in /_/src/coreclr/tools/Common/TypeSystem/Common/ResolutionFailure.cs:line 93
2>   at Internal.TypeSystem.Ecma.EcmaModule.GetType(String, String, NotFoundBehavior) in /_/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaModule.cs:line 344
2>   at Internal.TypeSystem.ModuleDesc.GetType(String, String, Boolean ) in /_/src/coreclr/tools/Common/TypeSystem/Common/ModuleDesc.cs:line 35
2>   at Internal.TypeSystem.CustomAttributeTypeNameParser.ResolveCustomAttributeTypeDefinitionName(String, ModuleDesc, Boolean) in /_/src/coreclr/tools/Common/TypeSystem/Common/Utilities/CustomAttributeTypeNameParser.cs:line 261
2>   at Internal.TypeSystem.CustomAttributeTypeNameParser.GetTypeByCustomAttributeTypeName(ModuleDesc, String, Boolean , Func`4 ) in /_/src/coreclr/tools/Common/TypeSystem/Common/Utilities/CustomAttributeTypeNameParser.cs:line 76
2>   at ILCompiler.RdXmlRootProvider.ProcessTypeDirective(IRootingServiceProvider, ModuleDesc, XElement) in /_/src/coreclr/tools/aot/ILCompiler/RdXmlRootProvider.cs:line 98
2>   at ILCompiler.RdXmlRootProvider.ProcessAssemblyDirective(IRootingServiceProvider, XElement) in /_/src/coreclr/tools/aot/ILCompiler/RdXmlRootProvider.cs:line 83
2>   at ILCompiler.RdXmlRootProvider.AddCompilationRoots(IRootingServiceProvider) in /_/src/coreclr/tools/aot/ILCompiler/RdXmlRootProvider.cs:line 47
2>   at ILCompiler.Compilation..ctor(DependencyAnalyzerBase`1, NodeFactory, IEnumerable`1, ILProvider, DebugInformationProvider, DevirtualizationManager, IInliningPolicy, Logger) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 64
2>   at ILCompiler.ILScannerBuilder.ToILScanner() in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs:line 83
2>   at ILCompiler.Program.<Run>g__RunScanner|73_4(<>c__DisplayClass73_0&) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 884
2>   at ILCompiler.Program.Run(String[]) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 866
2>   at ILCompiler.Program.Main(String[]) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 1150

Am I missing something? Is there some specific order of operations that has to be followed? Any help is appreciated.

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.