Bug 52748 - Out of memory build warning when referencing .NET Standard library project
Summary: Out of memory build warning when referencing .NET Standard library project
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 7.1 (C9)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-02-24 15:42 UTC by Matt Ward
Modified: 2017-06-27 21:25 UTC (History)
8 users (show)

Tags: bb
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Matt Ward 2017-02-24 15:42:53 UTC
To repro:

Pre-requisites:

a) Mono 4.8 from stable channel: (mono-4.8.0-branch/e4a3cf3 Fri Feb 17 15:57:45 EST 2017)
b) .NET Core SDK installed:
https://github.com/dotnet/core/blob/master/release-notes/rc4-download.md
c) Xamarin.Android 7.1.99.54 installed (not C9 stable but more recent Xamarin.Android needed to build Xamarin Studio from master).


1) Git clone: https://github.com/mrward/TestAndroidUsingNetCoreLib
2) Configure MSBuildSDKsPath environment variable to point to .NET Core:
export MSBuildSDKsPath=/usr/local/share/dotnet/sdk/1.0.0-rc4-004771/Sdks/
3) msbuild AndroidUsingNetCoreLibTest.sln

Expected result:

Build completes with no warnings.

Actual result:

See an out of memory error:

MSBUILD : warning : Out of memory  at (wrapper alloc) System.Object:AllocVector (intptr,intptr) [AndroidUsingNetCoreLibTest/AndroidUsingNetCoreLibTest.csproj]
MSBUILD : warning :   at Microsoft.Cci.Pdb.MsfDirectory..ctor (Microsoft.Cci.Pdb.PdbReader reader, Microsoft.Cci.Pdb.PdbFileHeader head, Microsoft.Cci.Pdb.BitAccess bits) [0x00066] in <3a9d58ceb0be40a686db802e33a73eae>:0  [/Users/matt/Projects/Tests/AndroidUsingNetCoreLibTest/AndroidUsingNetCoreLibTest.csproj]
MSBUILD : warning :   at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read, Microsoft.Cci.Pdb.BitAccess bits, System.Boolean readAllStrings) [0x00016] in <3a9d58ceb0be40a686db802e33a73eae>:0  [AndroidUsingNetCoreLibTest/AndroidUsingNetCoreLibTest.csproj]
MSBUILD : warning :   at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read, System.Boolean readAllStrings) [0x0000c] in <3a9d58ceb0be40a686db802e33a73eae>:0  [AndroidUsingNetCoreLibTest/AndroidUsingNetCoreLibTest.csproj]
MSBUILD : warning :   at Pdb2Mdb.Converter.Convert (System.String filename) [0x00033] in <3a9d58ceb0be40a686db802e33a73eae>:0  [/Users/matt/Projects/Tests/AndroidUsingNetCoreLibTest/AndroidUsingNetCoreLibTest.csproj]
MSBUILD : warning :   at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute () [0x0006a] in <3a9d58ceb0be40a686db802e33a73eae>:0  [AndroidUsingNetCoreLibTest/AndroidUsingNetCoreLibTest.csproj]


Looking at the diagnostic MSBuild output it seems that the _ConvertPdbFiles does not like the .pdb's being generated by MSBuild 15 for the .NETStandard library project.

Building target "_ConvertPdbFiles" completely.
Output file "AndroidUsingNetCoreLibTest/NetStandardLib/bin/Debug/netstandard1.4/NetStandardLib.dll.mdb" does not exist.
Using "ConvertDebuggingFiles" task from assembly "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Build.Tasks.dll".
Task "ConvertDebuggingFiles" (TaskId:165)
  Task Parameter:Files=/AndroidUsingNetCoreLibTest/NetStandardLib/bin/Debug/netstandard1.4/NetStandardLib.pdb (TaskId:165)
  ConvertDebuggingFiles Task (TaskId:165)
    InputFiles: AndroidUsingNetCoreLibTest/NetStandardLib/bin/Debug/netstandard1.4/NetStandardLib.pdb (TaskId:165)
MSBUILD : warning : Out of memory  at (wrapper alloc) System.Object:AllocVector (intptr,intptr) [AndroidUsingNetCoreLibTest/AndroidUsingNetCoreLibTest.csproj]


The Android application still runs fine after building.
Comment 1 Clay 2017-04-07 16:08:11 UTC
My project I've been working on for weeks no longer runs after updating VS2017 this morning.

To make sure it wasn't my code I did the following:
I get this error (shown above) after creating a brand new Android project from template that has a shared pcl.  Without editing the project, I build, then deploy to emulator or device and the app launches but exits after a few seconds with the following shown in the application log:

[art] Unexpected CPU variant for X86 using defaults: x86
[monodroid] Trying to load sgen from: /data/app/com.smpcorp.adsdfasd-1/lib/x86/libmonosgen-2.0.so
[monodroid] Trying to load sgen from: /data/user/0/com.smpcorp.adsdfasd/files/.__override__/links/libmonosgen-2.0.so
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:50614,embedding=1
[monodroid] No assemblies found in '(null)' or '<unavailable>'. Assuming this is part of Fast Deployment. Exiting...
Comment 2 ekeolereolaide 2017-04-07 19:07:55 UTC
Had same issue, then checked for updates and 4 updates came. Still had issue after update but then decided to change from debug to release and it worked.
Comment 3 Alex Chernov 2017-04-08 14:58:27 UTC
Have same issue after installing Visual Studio for Mac latest update (Preview 6, version 7 build 2715). Have 5 errors like this after build as warnings...

Warning: Out of memory  at (wrapper alloc) System.Object:AllocVector (intptr,intptr)
  at Microsoft.Cci.Pdb.MsfDirectory..ctor (Microsoft.Cci.Pdb.PdbReader reader, Microsoft.Cci.Pdb.PdbFileHeader head, Microsoft.Cci.Pdb.BitAccess bits) [0x00066] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 
  at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read, Microsoft.Cci.Pdb.BitAccess bits, System.Boolean readAllStrings) [0x00016] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 
  at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read, System.Boolean readAllStrings) [0x0000c] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 
  at Pdb2Mdb.Converter.Convert (System.String filename) [0x00033] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 
  at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute () [0x0006a] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0  (NexpaqApplication.Droid)

=== Visual Studio for Mac Preview ===

Version Preview 6 (7.0 build 2715)
Installation UUID: 20984443-2c99-4cdf-9198-55faf49fc1d3
Runtime:
	Mono 5.0.0.42 (2017-02/dda961c) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500000042

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
SDK: /usr/local/share/dotnet/sdk/1.0.1/Sdks
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.0.0/lib/mono/msbuild/15.0/bin/Sdks

=== NuGet ===

Version: 4.0.0.2323

=== Xamarin.Profiler ===

Version: 1.0.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 7.0.2.42 (Visual Studio Enterprise)
Android SDK: /Users/alexchernov/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 25.2.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Inspector ===

Version: 1.2.1
Hash: 0ea0a12
Branch: d15-1
Build date: Thu, 06 Apr 2017 20:24:44 GMT

=== Apple Developer Tools ===

Xcode 8.2.1 (11766.1)
Build 8C1002

=== Xamarin.iOS ===

Version: 10.4.0.20 (Visual Studio Enterprise)
Hash: 62816dd
Branch: master
Build date: 2016-11-15 06:24:02-0500

=== Xamarin.Mac ===

Version: 3.0.0.290 (Visual Studio Enterprise)

=== Build Information ===

Release ID: 700002715
Git revision: cd1b560640f94595db9bfc6f8fdf5f57daa1b597
Build date: 2017-04-05 05:50:44-04
Xamarin addins: c75861dcb3f7865bd70921324fe9a72561229744
Build lane: monodevelop-lion-d15-2

=== Operating System ===

Mac OS X 10.11.6
Darwin Alexs-MacBook-Pro-2.local 15.6.0 Darwin Kernel Version 15.6.0
    Fri Feb 17 10:21:18 PST 2017
    root:xnu-3248.60.11.4.1~1/RELEASE_X86_64 x86_64
Comment 4 Seifer 2017-04-10 14:53:27 UTC
Just update Xamarin Studio for Mac - Preview 6 (7.0 build 2715) and have exactly the same error as @Alex Chernov.

But I don't have any .NET Standard libraries/packages added to the project.

iOS project launched ok.
Android project fails to lunch.
Comment 5 Alex Chernov 2017-04-11 05:14:08 UTC
@Seifer check for updates one more time you will see 4 more, after update your problem should be solved, worked for me
Comment 6 Seifer 2017-04-11 14:07:49 UTC
Thanks, @Alex! I've updated some components from the downloaded installer and today found that there is something to update from the Visual Studio (alpha channel).

Now it works.
Comment 7 Tom Opgenorth 2017-06-27 21:25:15 UTC
Just tried this with .NET Core 1.1, and the solution built fine. Going to assume that one of the updates to either Xamarin.Android or .NET core in the last 5 months fixed this problem.