This repository was archived by the owner on Nov 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 506
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
samples/WebApi doesn't work with .NET Core 2.1 #5720
Copy link
Copy link
Closed
Description
I encountered this on my own project, so I tried with the WebApi sample and got the same issue.
I tested before changing anything and everything worked.
I updated the csproj file to use 2.1 instead of 2.0, so it now looks like this:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<RdXmlFile Include="rd.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.1.0-preview2-final" />
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
</ItemGroup>
</Project>I had to remove the Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv entry from rd.xml because 2.1-preview2 no longer uses libuv.
With those changes, when I ran dotnet publish -c Release -r win-x64 I got the following output:
λ dotnet publish -c Release -r win-x64
Microsoft (R) Build Engine version 15.6.22.57775 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 52.32 ms for C:\Labs\dotnet\corert\samples\WebApi\SampleWebApi.csproj.
SampleWebApi -> C:\Labs\dotnet\corert\samples\WebApi\bin\Release\netcoreapp2.1\win-x64\SampleWebApi.dll
Generating native code
EXEC : warning : RD.XML processing will change before release (https://github.com/dotnet/corert/issues/5001) [C:\Labs\dotnet\corert\samples\WebApi\SampleWebApi.csproj]
EXEC : error : [TEMPORARY EXCEPTION MESSAGE] ClassLoadGeneral: System.Reflection.Emit.ILGenerator, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a [C:\Labs\dotnet\corert\samples\WebApi\SampleWebApi.csproj]
Internal.TypeSystem.TypeSystemException+TypeLoadException: [TEMPORARY EXCEPTION MESSAGE] ClassLoadGeneral: System.Reflection.Emit.ILGenerator, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
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.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.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey key)
at Internal.TypeSystem.Ecma.EcmaModule.GetObject(EntityHandle handle)
at Internal.TypeSystem.Ecma.EcmaModule.GetType(EntityHandle handle)
at Internal.TypeSystem.Ecma.EcmaSignatureParser.ParseType(SignatureTypeCode typeCode)
at Internal.TypeSystem.Ecma.EcmaSignatureParser.ParseFieldSignature()
at Internal.TypeSystem.Ecma.EcmaField.InitializeFieldType()
at Internal.TypeSystem.MetadataFieldLayoutAlgorithm.ComputeInstanceLayout(DefType defType, InstanceLayoutKind layoutKind)
at Internal.TypeSystem.DefType.ComputeInstanceLayout(InstanceLayoutKind layoutKind)
at ILCompiler.DependencyAnalysis.EETypeNode.CheckCanGenerateEEType(NodeFactory factory, TypeDesc type)
at ILCompiler.DependencyAnalysis.NodeFactory.<CreateNodeCaches>b__36_1(TypeDesc type)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at ILCompiler.Compilation.RootingServiceProvider.AddCompilationRoot(TypeDesc type, String reason)
at ILCompiler.RdXmlRootProvider.RootType(IRootingServiceProvider rootProvider, TypeDesc type)
at ILCompiler.RdXmlRootProvider.ProcessAssemblyDirective(IRootingServiceProvider rootProvider, XElement assemblyElement)
at ILCompiler.RdXmlRootProvider.AddCompilationRoots(IRootingServiceProvider rootProvider)
at ILCompiler.Compilation..ctor(DependencyAnalyzerBase`1 dependencyGraph, NodeFactory nodeFactory, IEnumerable`1 compilationRoots, DebugInformationProvider debugInformationProvider, DevirtualizationManager devirtualizationManager, Logger logger)
at ILCompiler.ILScannerBuilder.ToILScanner()
at ILCompiler.Program.Run(String[] args)
at ILCompiler.Program.Main(String[] args)
C:\Users\mark\.nuget\packages\microsoft.dotnet.ilcompiler\1.0.0-alpha-26417-01\build\Microsoft.NETCore.Native.targets(172,5): error MSB3073: The command ""C:\Users\mark\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\1.0.0-alpha-26417-01\tools\ilc" @"obj\Release\netcoreapp2.1\win-x64\native\SampleWebApi.ilc.rsp"" exited with code 1. [C:\Labs\dotnet\corert\samples\WebApi\SampleWebApi.csproj]
Environment info
Windows 10 Pro 1709 Build 16299.371
$ dotnet --version
2.1.300-preview2-008530
ErazerBrecht
Metadata
Metadata
Assignees
Labels
No labels