Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception of type 'System.OutOfMemoryException' was thrown. #34

Open
aalmada opened this issue Nov 19, 2019 · 6 comments
Open

Exception of type 'System.OutOfMemoryException' was thrown. #34

aalmada opened this issue Nov 19, 2019 · 6 comments

Comments

@aalmada
Copy link

aalmada commented Nov 19, 2019

I'm using VS 2019, with .NET Core SDK 3.1.100-preview3 installed and a csproj file with the following:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  <PropertyGroup>
    <TargetFrameworks>net472</TargetFrameworks>
    <OutputType>exe</OutputType>
    <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="ilmerge" Version="3.0.29" />
    <PackageReference Include="ILMerge.MSBuild.Task" Version="1.0.7" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Bonsai.Configuration\Bonsai.Configuration.csproj" />
    <ProjectReference Include="..\Bonsai.Design\Bonsai.Design.csproj" />
    <ProjectReference Include="..\Bonsai.Editor\Bonsai.Editor.csproj" />
    <ProjectReference Include="..\Bonsai.NuGet\Bonsai.NuGet.csproj" />
  </ItemGroup>
</Project>

The ILMergeConfig.json file constains the following:

{
  "General": {
    "InputAssemblies": [
      "NuGet.Core.dll",
      "Bonsai.NuGet.dll",
      "Bonsai.Configuration.dll"
    ]
  },
  "Advanced": {
    "ExcludeFile": "ilmerge.internalize.exclude.txt",
    "Internalize": true
  }
}

I get the following log:

6>C:\Users\antao\.nuget\packages\ilmerge.msbuild.task\1.0.7\build\ILMerge.MSBuild.Task.targets(13,5): error : ILMerge.Merge: 	There were errors reported in Bonsai's metadata.
6>C:\Users\antao\.nuget\packages\ilmerge.msbuild.task\1.0.7\build\ILMerge.MSBuild.Task.targets(13,5): error : 	Exception of type 'System.OutOfMemoryException' was thrown.

Removing the Advanced section results in the same error.

The project can be found at https://bitbucket.org/aalmada/bonsai/src/netcoreapp3.0/Bonsai/

@nZeus
Copy link

nZeus commented Apr 8, 2020

Trying to use it with the .Net 4.7.2 application and also get the OutOfMemory exception:
image

My config is super simple:

{
  "General": {
    "InputAssemblies": [
      "IdentityModel.dll"
    ]
  }
}

@nZeus
Copy link

nZeus commented Apr 8, 2020

It happens during the first compilation, when the output folder is empty.
When I build my project for the second time - this exception doesn't occur anymore. But it seems the assembly didn't get merged

@aalmada
Copy link
Author

aalmada commented Apr 13, 2020

@nZeus I switched to ILRepack with ILRepack.MSBuild.Task.

https://github.com/aalmada/bonsai/blob/d396a981cbee3cfdf34197f8b3b0aafaa6b29f8b/Bonsai/Bonsai.csproj#L144

@nZeus
Copy link

nZeus commented Apr 13, 2020

I did the same :)

@pinkfloydx33
Copy link

FYI The issue is the DebugType which defaults to portable for new SDK-style projects. Setting

<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>

Fixes it for me

@feminho
Copy link

feminho commented May 14, 2020

Same errore here. I have a 4.5.2 project that works but on 4.7.2 it crashes, event with my project setted with DebugSymbols and DebugType as said @pinkfloydx33

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

No branches or pull requests

4 participants