dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
http://dot.net
MIT License
2.91k stars 508 forks source link

Not Working for WPF #7904

Open SasukeK93 opened 4 years ago

SasukeK93 commented 4 years ago

CoreRT Native Build for C# WPF Aplication .NetCore 3.0 isn't propertly working:

dotnet new wpf dotnet new nuget // Add the nuget References to nuget.config dotnet add package Microsoft.DotNet.ILCompiler -v 1.0.0-alpha-* dotnet publish -r win-x64 -c release

Build Output:

Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.

Restore completed in 5.89 min for C:\Users\SasukeK93\wpf\wpf.csproj. wpf -> C:\Users\SasukeK93\wpf\bin\release\netcoreapp3.0\win-x64\wpf.dll Generating compatible native code. To optimize for size or speed, visit https://aka.ms/OptimizeCoreRT EXEC : error : [TEMPORARY EXCEPTION MESSAGE] ClassLoadGeneral: System.Windows.Threading.DispatcherObject, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 [C:\Users\SasukeK93\wpf\wpf.csproj] Internal.TypeSystem.TypeSystemException+TypeLoadException: [TEMPORARY EXCEPTION MESSAGE] ClassLoadGeneral: System.Windows.Threading.DispatcherObject, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 at Internal.TypeSystem.ThrowHelper.ThrowTypeLoadException(ExceptionStringID id, String typeName, String assemblyName) at Internal.TypeSystem.Ecma.EcmaModule.GetType(String nameSpace, String name, Boolean throwIfNotFound) at Internal.TypeSystem.Ecma.EcmaModule.ResolveTypeReference(TypeReferenceHandle handle) at Internal.TypeSystem.Ecma.EcmaModule.EcmaObjectLookupHashtable.CreateValueFromKey(EntityHandle handle) at Internal.TypeSystem.LockFreeReaderHashtable2.CreateValueAndEnsureValueIsInTable(TKey key) at Internal.TypeSystem.Ecma.EcmaModule.GetObject(EntityHandle handle) at Internal.TypeSystem.Ecma.EcmaModule.GetType(EntityHandle handle) at Internal.TypeSystem.Ecma.EcmaType.InitializeBaseType() at Internal.TypeSystem.TypeDesc.get_IsDelegate() at ILCompiler.CompilerTypeSystemContext.GetAllMethods(TypeDesc type) at Internal.TypeSystem.MetadataVirtualMethodAlgorithm.FindMatchingVirtualMethodOnTypeByNameAndSig(MethodDesc targetMethod, DefType currentType, Boolean reverseMethodSearch, Func3 nameSigMatchMethodIsValidCandidate) at Internal.TypeSystem.MetadataVirtualMethodAlgorithm.FindBaseUnificationGroup(MetadataType currentType, UnificationGroup unificationGroup) at Internal.TypeSystem.MetadataVirtualMethodAlgorithm.FindBaseUnificationGroup(MetadataType currentType, UnificationGroup unificationGroup) at Internal.TypeSystem.MetadataVirtualMethodAlgorithm.FindVirtualFunctionTargetMethodOnObjectType(MethodDesc targetMethod, MetadataType objectType) at Internal.TypeSystem.Ecma.EcmaType.GetFinalizer() at Internal.TypeSystem.Ecma.EcmaType.ComputeTypeFlags(TypeFlags mask) at Internal.TypeSystem.TypeDesc.InitializeTypeFlags(TypeFlags mask) at Internal.TypeSystem.TypeDesc.get_HasFinalizer() at Internal.TypeSystem.MethodDesc.get_IsFinalizer() at ILCompiler.MetadataManager.IsMethodSupportedInReflectionInvoke(MethodDesc method) at ILCompiler.MetadataManager.GetDependenciesDueToReflectability(DependencyList& dependencies, NodeFactory factory, MethodDesc method) at ILCompiler.DependencyAnalysis.CodeBasedDependencyAlgorithm.AddDependenciesDueToMethodCodePresence(DependencyList& dependencies, NodeFactory factory, MethodDesc method) at ILCompiler.DependencyAnalysis.ScannedMethodNode.InitializeDependencies(NodeFactory factory, IEnumerable1 dependencies) at ILCompiler.ILScanner.CompileSingleMethod(ScannedMethodNode methodCodeNodeNeedingCode) at ILCompiler.ILScanner.CompileSingleThreaded(List1 methodsToCompile) at ILCompiler.ILScanner.ComputeDependencyNodeDependencies(List1 obj) at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer2.ComputeMarkedNodes() at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() at ILCompiler.Program.Run(String[] args) at ILCompiler.Program.Main(String[] args) C:\Users\SasukeK93.nuget\packages\microsoft.dotnet.ilcompiler\1.0.0-alpha-28406-02\build\Microsoft.NETCore.Native.targets(226,5): error MSB3073: The command ""C:\Users\SasukeK93.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\1.0.0-alpha-28406-02\tools\ilc" @"obj\release\netcoreapp3.0\win-x64\native\wpf.ilc.rsp"" exited with code 1. [C:\Users\SasukeK93\wpf\wpf.csproj]

charlesroddie commented 4 years ago

See https://github.com/dotnet/corert/issues/6940

SasukeK93 commented 4 years ago

See #6940

Thanks, i already see that, but in the version that i'am using "1.0.0-alpha-28406-02" + NetCore 3.0 + Win 10-x64 perfectly works for Windows Forms. But not for WPF.

MichalStrehovsky commented 4 years ago

WPF relies on COM heavily. COM is not supported by CoreRT yet (tracked in #4219).

I tried how far along I can get with an empty WPF application, but text input services, UI automation, etc. are used right in the startup path. They're all based on COM. An empty window will show, but the app crashes right after.