Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Does IL compiler support .NET Core 3.0 WinForms? #6359

Open
ghost opened this issue Sep 21, 2018 · 3 comments
Open

Does IL compiler support .NET Core 3.0 WinForms? #6359

ghost opened this issue Sep 21, 2018 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Sep 21, 2018

I don't think it's an appropriate question or issue, but I think some one wondering about it.

To test Windows Forms support for .NET Core 3.0, I created a new Windows Forms project with a 3.0.100-alpha1-009616 daily build. Then, I added the package of CoreRT Daily Build 1.0.0-alpha-26921-02 to the project created and published it to win-x64 RID.

As a result, the publish command now fails with the following stack trace results (Please understand that I am using the Korean Windows locale for messages in Korean):

.NET Core용 Microsoft (R) Build Engine 버전 15.9.8-preview+g0a5001fc4d
Copyright (C) Microsoft Corporation. All rights reserved.

  C:\Users\rkttu\Projects\WinFormTest\WinFormTest.csproj의 패키지를 복원하는 중...
  1.04 sec에서 C:\Users\rkttu\Projects\WinFormTest\WinFormTest.csproj에 대한 복원을 완료했습니다.
C:\Program Files\dotnet\sdk\3.0.100-alpha1-009616\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(143,5): message NETSDK1057: .NET Core SDK의 미리 보기 버전으로 작업하고 있습니다. 현재 프로젝트의 global.json 파일을 통해 SDK 버전을 정의할 수 있습니다. 자세한 내용은 https://go.microsoft.com/fwlink/?linkid=869452를 참조하세요. [C:\Users\rkttu\Projects\WinFormTest\WinFormTest.csproj]
  WinFormTest -> C:\Users\rkttu\Projects\WinFormTest\bin\Debug\netcoreapp3.0\win-x64\WinFormTest.dll
  Generating native code
EXEC : error : [TEMPORARY EXCEPTION MESSAGE] InvalidProgramSpecific: Void CorRuntimeHost..ctor() [C:\Users\rkttu\Projects\WinFormTest\WinFormTest.csproj]
  Internal.TypeSystem.TypeSystemException+InvalidProgramException: [TEMPORARY EXCEPTION MESSAGE] InvalidProgramSpecific: Void CorRuntimeHost..ctor()
     at Internal.TypeSystem.ThrowHelper.ThrowInvalidProgramException(ExceptionStringID id, MethodDesc method)
     at ILCompiler.DependencyAnalysis.RyuJitNodeFactory.CreateMethodEntrypointNode(MethodDesc method)
     at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
     at ILCompiler.DependencyAnalysis.ConstructedEETypeNode.ComputeNonRelocationBasedDependencies(NodeFactory factory)
     at ILCompiler.DependencyAnalysis.ObjectNode.GetStaticDependencies(NodeFactory factory)
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node)
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack()
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes()
     at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper)
     at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper)
     at ILCompiler.Program.Run(String[] args)
     at ILCompiler.Program.Main(String[] args)
C:\Users\rkttu\.nuget\packages\microsoft.dotnet.ilcompiler\1.0.0-alpha-26921-02\build\Microsoft.NETCore.Native.targets(200,5): error MSB3073: ""C:\Users\rkttu\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\1.0.0-alpha-26921-02\tools\ilc" @"obj\Debug\netcoreapp3.0\win-x64\native\WinFormTest.ilc.rsp"" 명령이 종료되었습니다(코드: 1). [C:\Users\rkttu\Projects\WinFormTest\WinFormTest.csproj]

And for win-x86, which is a different RID, the following error message is displayed:

.NET Core용 Microsoft (R) Build Engine 버전 15.9.8-preview+g0a5001fc4d
Copyright (C) Microsoft Corporation. All rights reserved.

  C:\Users\rkttu\Projects\WinFormTest\WinFormTest.csproj의 패키지를 복원하는 중...
  1.26 sec에서 C:\Users\rkttu\Projects\WinFormTest\WinFormTest.csproj에 대한 복원을 완료했습니다.
C:\Program Files\dotnet\sdk\3.0.100-alpha1-009616\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(143,5): message NETSDK1057: .NET Core SDK의 미리 보기 버전으로 작업하고 있습니다. 현재 프로젝트의 global.json 파일을 통해 SDK 버전을 정의할 수 있습니다. 자세한 내용은 https://go.microsoft.com/fwlink/?linkid=869452를 참조하세요. [C:\Users\rkttu\Projects\WinFormTest\WinFormTest.csproj]
  WinFormTest -> C:\Users\rkttu\Projects\WinFormTest\bin\Debug\netcoreapp3.0\win-x86\WinFormTest.dll
C:\Users\rkttu\.nuget\packages\microsoft.dotnet.ilcompiler\1.0.0-alpha-26921-02\build\Microsoft.NETCore.Native.Publish.targets(61,5): error : The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative [C:\Users\rkttu\Projects\WinFormTest\WinFormTest.csproj]

It is in the above state.

So, I would like to know the cause of the above error. And I want to know if CoreRT's next preview will support .NET Core 3.0.

@ghost ghost changed the title Does CoreRT support .NET Core 3.0? Does IL compiler support .NET Core 3.0? Sep 21, 2018
@jkotas jkotas changed the title Does IL compiler support .NET Core 3.0? Does IL compiler support .NET Core 3.0 WinForms? Sep 21, 2018
@jkotas
Copy link
Member

jkotas commented Sep 21, 2018

WinForms depends on COM interop. CoreRT does not support COM interop currently. It is tracked by #4219

@DocBrown101
Copy link

Is there anything new regarding of .net core 3?

@MichalStrehovsky
Copy link
Member

After #7567, very basic WinForms apps will work. One needs to add a <RootAllApplicationAssemblies>false</RootAllApplicationAssemblies> property to the app's csproj file, otherwise we would also try to compile WPF and that's a whole different level.

Also, add <RdXmlFile Include="rd.xml" /> to an ItemGroup in the CSPROJ. The contents of the rd.xml file should be:

<Directives>
    <Application>
        <Assembly Name="System.Drawing.Primitives">
            <Type Name="System.Drawing.KnownColorTable">
                <Method Name="CreateGetter" Dynamic="Required">
                    <GenericArgument Name="Microsoft.Win32.UserPreferenceChangingEventArgs, System" />
                    <GenericArgument Name="Microsoft.Win32.UserPreferenceCategory, System" />
                </Method>
            </Type>
        </Assembly>
    </Application>
</Directives>

This is to make some reflection lightup in System.Drawing to work.

More complex WinForms apps are going to hit missing COM support (#4219), so don't get your hopes too high up.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants