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

Internal.TypeSystem.TypeSystemException+TypeLoadException: [TEMPORARY EXCEPTION MESSAGE] #5627

Closed
ghost opened this issue Mar 27, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 27, 2018

I am trying to create a single executable file targeting x86 windows, from a .net core 2.0 project. The command that I execute on x86 Native Tools Command Prompt for VS 2017 is :

dotnet publish DataSoft.ServiceIntegration.csproj -c Release -r win7-86 --output native /p:IlcPath=c:\work\CoreRT\bin\Windows_NT.x64.Release

Here is the output I get :

Microsoft (R) Build Engine version 15.6.82.30579 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 54,81 ms for C:\Work\Server\DataSoft.ServiceIntegration\DataSoft.ServiceIntegration.csproj.
  DataSoft.ServiceIntegration -> C:\Work\Server\DataSoft.ServiceIntegration\bin\x86\Release\netcoreapp2.0\win7-x86\DataSoft.ServiceIntegration.dll
  Generating native code
EXEC : error : [TEMPORARY EXCEPTION MESSAGE] ClassLoadGeneral: System.Reflection.Emit.AssemblyBuilder, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a [C:\Work\Server\DataSoft.ServiceIntegration\DataSoft.ServiceIntegration.csproj]
  Internal.TypeSystem.TypeSystemException+TypeLoadException: [TEMPORARY EXCEPTION MESSAGE] ClassLoadGeneral: System.Reflection.Emit.AssemblyBuilder, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
     at Internal.TypeSystem.ThrowHelper.ThrowTypeLoadException(ExceptionStringID id, String typeName, String assemblyName) in C:\Work\CoreRT\src\Common\src\TypeSystem\Common\ThrowHelper.cs:line 18
     at Internal.TypeSystem.Ecma.EcmaModule.GetType(String nameSpace, String name, Boolean throwIfNotFound) in C:\Work\CoreRT\src\Common\src\TypeSystem\Ecma\EcmaModule.cs:line 296
     at Internal.TypeSystem.Ecma.EcmaModule.GetType(String nameSpace, String name, Boolean throwIfNotFound) in C:\Work\CoreRT\src\Common\src\TypeSystem\Ecma\EcmaModule.cs:line 299
     at Internal.TypeSystem.Ecma.EcmaModule.ResolveTypeReference(TypeReferenceHandle handle) in C:\Work\CoreRT\src\Common\src\TypeSystem\Ecma\EcmaModule.cs:line 455
     at Internal.TypeSystem.Ecma.EcmaModule.EcmaObjectLookupHashtable.CreateValueFromKey(EntityHandle handle) in C:\Work\CoreRT\src\Common\src\TypeSystem\Ecma\EcmaModule.cs:line 117
     at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey key) in C:\Work\CoreRT\src\Common\src\TypeSystem\Common\Utilities\LockFreeReaderHashtable.cs:line 417
     at Internal.TypeSystem.Ecma.EcmaModule.GetObject(EntityHandle handle) in C:\Work\CoreRT\src\Common\src\TypeSystem\Ecma\EcmaModule.cs:line 327
     at Internal.TypeSystem.Ecma.EcmaModule.GetType(EntityHandle handle) in C:\Work\CoreRT\src\Common\src\TypeSystem\Ecma\EcmaModule.cs:line 303
     at Internal.TypeSystem.Ecma.EcmaSignatureParser.ParseType(SignatureTypeCode typeCode) in C:\Work\CoreRT\src\Common\src\TypeSystem\Ecma\EcmaSignatureParser.cs:line 73
     at Internal.TypeSystem.Ecma.EcmaSignatureParser.ParseFieldSignature() in C:\Work\CoreRT\src\Common\src\TypeSystem\Ecma\EcmaSignatureParser.cs:line 237
     at Internal.TypeSystem.Ecma.EcmaField.InitializeFieldType() in C:\Work\CoreRT\src\Common\src\TypeSystem\Ecma\EcmaField.cs:line 102
     at Internal.TypeSystem.MetadataFieldLayoutAlgorithm.ComputeInstanceLayout(DefType defType, InstanceLayoutKind layoutKind) in C:\Work\CoreRT\src\Common\src\TypeSystem\Common\MetadataFieldLayoutAlgorithm.cs:line 37
     at Internal.TypeSystem.DefType.ComputeInstanceLayout(InstanceLayoutKind layoutKind) in C:\Work\CoreRT\src\Common\src\TypeSystem\Common\DefType.FieldLayout.cs:line 304
     at ILCompiler.DependencyAnalysis.EETypeNode.CheckCanGenerateEEType(NodeFactory factory, TypeDesc type) in C:\Work\CoreRT\src\ILCompiler.Compiler\src\Compiler\DependencyAnalysis\EETypeNode.cs:line 1098
     at ILCompiler.DependencyAnalysis.NodeFactory.<CreateNodeCaches>b__36_1(TypeDesc type) in C:\Work\CoreRT\src\ILCompiler.Compiler\src\Compiler\DependencyAnalysis\NodeFactory.cs:line 198
     at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
     at ILCompiler.DependencyAnalysis.CodeBasedDependencyAlgorithm.AddDependenciesDueToReflectability(DependencyList& dependencies, NodeFactory factory, MethodDesc method) in C:\Work\CoreRT\src\ILCompiler.Compiler\src\Compiler\DependencyAnalysis\CodeBasedDependencyAlgorithm.cs:line 21
     at ILCompiler.DependencyAnalysis.CodeBasedDependencyAlgorithm.AddDependenciesDueToMethodCodePresence(DependencyList& dependencies, NodeFactory factory, MethodDesc method) in C:\Work\CoreRT\src\ILCompiler.Compiler\src\Compiler\DependencyAnalysis\CodeBasedDependencyAlgorithm.cs:line 75
     at ILCompiler.ILScanner.ComputeDependencyNodeDependencies(List`1 obj) in C:\Work\CoreRT\src\ILCompiler.Compiler\src\Compiler\ILScanner.cs:line 73
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in C:\Work\CoreRT\src\ILCompiler.DependencyAnalysisFramework\src\DependencyAnalyzer.cs:line 262
     at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() in C:\Work\CoreRT\src\ILCompiler.Compiler\src\Compiler\ILScanner.cs:line 83
     at ILCompiler.Program.Run(String[] args) in C:\Work\CoreRT\src\ILCompiler\src\Program.cs:line 408
     at ILCompiler.Program.Main(String[] args) in C:\Work\CoreRT\src\ILCompiler\src\Program.cs:line 619
C:\Work\CoreRT\bin\Windows_NT.x64.Release\build\Microsoft.NETCore.Native.targets(171,5): error MSB3073: The command ""C:\Work\CoreRT\bin\Windows_NT.x64.Release\tools\ilc" @"obj\x86\Release\netcoreapp2.0\win7-x86\native\DataSoft.ServiceIntegration.ilc.rsp"" exited with code 1. [C:\Work\Server\DataSoft.ServiceIntegration\DataSoft.ServiceIntegration.csproj]

This is my csproj file :

<Project>
  <Import Project="$(MSBuildSDKsPath)\Microsoft.NET.Sdk\Sdk\Sdk.props" />
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
    <AssemblyName>DataSoft.ServiceIntegration</AssemblyName>
    <RootNamespace>DataSoft.ServiceIntegration</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <None Remove="appsettings.json" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="appsettings.json">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="DataSoft.Common">
      <HintPath>DllLib\DataSoft.Common.dll</HintPath>
    </Reference>
    <Reference Include="DataSoft.DAL.Integration">
      <HintPath>DllLib\DataSoft.DAL.Integration.dll</HintPath>
    </Reference>
    <Reference Include="DataSoft.DataTransferObjects">
      <HintPath>DllLib\DataSoft.DataTransferObjects.dll</HintPath>
    </Reference>
    <Reference Include="DataSoft.Domain">
      <HintPath>DllLib\DataSoft.Domain.dll</HintPath>
    </Reference>
    <Reference Include="DataSoft.ModelDtoConversions">
      <HintPath>DllLib\DataSoft.ModelDtoConversions.dll</HintPath>
    </Reference>
    <Reference Include="DataSoft.Repository.Integration">
      <HintPath>DllLib\DataSoft.Repository.Integration.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Configuration">
      <HintPath>DllLib\Microsoft.Extensions.Configuration.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Configuration.Abstractions">
      <HintPath>DllLib\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Configuration.Binder">
      <HintPath>DllLib\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Configuration.FileExtensions">
      <HintPath>DllLib\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Configuration.Json">
      <HintPath>DllLib\Microsoft.Extensions.Configuration.Json.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.DependencyInjection">
      <HintPath>DllLib\Microsoft.Extensions.DependencyInjection.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
      <HintPath>DllLib\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.FileProviders.Abstractions">
      <HintPath>DllLib\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.FileProviders.Physical">
      <HintPath>DllLib\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.FileSystemGlobbing">
      <HintPath>DllLib\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Options">
      <HintPath>DllLib\Microsoft.Extensions.Options.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Options.ConfigurationExtensions">
      <HintPath>DllLib\Microsoft.Extensions.Options.ConfigurationExtensions.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Extensions.Primitives">
      <HintPath>DllLib\Microsoft.Extensions.Primitives.dll</HintPath>
    </Reference>
    <Reference Include="Newtonsoft.Json">
      <HintPath>DllLib\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="System.Net.Http.Formatting">
      <HintPath>DllLib\System.Net.Http.Formatting.dll</HintPath>
    </Reference>
    <Reference Include="System.Private.ServiceModel">
      <HintPath>DllLib\System.Private.ServiceModel.dll</HintPath>
    </Reference>
    <Reference Include="System.ServiceModel.Http">
      <HintPath>DllLib\System.ServiceModel.Http.dll</HintPath>
    </Reference>
    <Reference Include="System.ServiceModel.Primitives">
      <HintPath>DllLib\System.ServiceModel.Primitives.dll</HintPath>
    </Reference>
  </ItemGroup>
  <Import Project="$(MSBuildSDKsPath)\Microsoft.NET.Sdk\Sdk\Sdk.targets" />
  <Import Project="$(IlcPath)\build\Microsoft.NETCore.Native.targets" />
</Project>

I have tried every solution I have found online with no luck so far. Can someone please point me in the right direction ?

Thanks in advance.

@jkotas
Copy link
Member

jkotas commented Mar 27, 2018

System.Reflection.Emit.AssemblyBuilder

CoreRT does not support Reflection.Emit (#5011). Also, it works on x64 only; no x86 yet (#4589).

@ghost
Copy link
Author

ghost commented Mar 27, 2018

I didn't know about Reflection.Emit, and I thought x86 was supported from #4598

Nevertheless, thank you for your response.

@ghost ghost closed this as completed Mar 27, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant