MG 3.7.0.1232 on Android doesn't work with assets

Hi!
I just noticed the other day, that when installing the latest dev-build (3.7.0.1232) you get a crash when deploying to the Android-emulator IF and only if you’re using a game-asset of some kind (texture and spriteFont tested).
For details see below.

History…


From gitter :slight_smile:

Heya all! I just tried an Android project and everything works fine (VS2017, MG develop build from yesterday), except when I want to load an asset (SpriteFont in my case). The asset is not found on the emulator (and I get poor debugger support, but that was to be expected ).
I put the asset file in the content folder, added it to the pipeline-file using the GUI and built the game.
Did I miss something?

OK. Trying with a texture…
Nope. Same problem with a texture. Program on emulator just stops.

Stacktrace:
01-27 21:46:15.475 E/mono-rt ( 1432): 
01-27 21:46:15.475 E/mono-rt ( 1432):   at <unknown> <0xffffffff>
01-27 21:46:15.475 E/mono-rt ( 1432):   at (wrapper managed-to-native) object.wrapper_native_0xb71ade40 (MonoGame.OpenGL.TextureTarget,int) <0x00012>
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Graphics.Texture2D.GenerateGLTextureIfRequired () [0x0005b] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Graphics.Texture2D/<>c__DisplayClass1.<PlatformConstruct>b__0 () [0x00006] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Threading.BlockOnUIThread (System.Action) [0x0002d] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Graphics.Texture2D.PlatformConstruct (int,int,bool,Microsoft.Xna.Framework.Graphics.SurfaceFormat,Microsoft.Xna.Framework.Graphics.Texture2D/SurfaceType,bool) [0x00064] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Graphics.Texture2D..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice,int,int,bool,Microsoft.Xna.Framework.Graphics.SurfaceFormat,Microsoft.Xna.Framework.Graphics.Texture2D/SurfaceType,bool,int) [0x000ca] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Graphics.Texture2D..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice,int,int,bool,Microsoft.Xna.Framework.Graphics.SurfaceFormat) [0x0000b] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Content.Texture2DReader.Read (Microsoft.Xna.Framework.Content.ContentReader,Microsoft.Xna.Framework.Graphics.Texture2D) [0x001a6] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Content.ContentTypeReader`1<T_REF>.Read (Microsoft.Xna.Framework.Content.ContentReader,object) [0x0000e] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject<T_REF> (T_REF) [0x00035] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Content.ContentReader.ReadObject<T_REF> () [0x0000a] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset<T_REF> () [0x00007] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset<T_REF> (string,System.Action`1<System.IDisposable>) [0x00082] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at Microsoft.Xna.Framework.Content.ContentManager.Load<T_REF> (string) [0x0005d] in <c10a9ffa751749f5868c676ed8ffd98d>:0
01-27 21:46:15.475 E/mono-rt ( 1432):   at TestAndroid.Game1.LoadContent () [0x00012] in C:\Source\InputStateManager\TestAndroid\Game1.cs:41

Seems like the texture couldn’t be allocated?!?

OK. Just re-installed MG 3.6 (as just posted) and re-created an Android project. Works now. Texture is exported & shown. No problem now.
Re-installing MG 3.7 and re-trying…

Re-installed MG 3.7.0.1232 (always + templates for VS), created new Android project. Added Spritefont and loaded it -> same crash as before.
Running old (MG 3.6 - created) project now that MG 3.7 is installed. Still works. Seems to be something in the templates.
No. It’s not. The pipeline wasn’t triggered after installing MG 3.7 because no asset changed.

It’s about the pipeline alright. Triggered a rebuild by deleting the bin and object folder and it doesn’t work.
Project created with 3.6 template, built with 3.7 pipeline.

Oh. One more thing.
Sorry if I missed something obvious but AFAIK I didn’t.
Didn’t find anything on GitHub either.

OpenGL project works with MG 3.7.0.1232. No problem there.

OK. Last information before I go to sleep:
Doesn’t seem to be the pipeline.exe.
When deleting the bin- and object-folders of the Content directory, then the pipeline re-builds. But that’s ok. That doesn’t corrupt anything.
The thing that makes the app break on Android is rebuilding the solution. When deleting the bin- and obj-folders of the project!
So I believe that the way that the xnb files are copied to the target folders is broken on the newest MG 3.7 installs.
btw. just tried a 3.7 version I downloaded previously (3.7.0.960) and it works with that one.
So the bug was introduced somewhere after that build.
n8

This is probably caused by the changes in https://github.com/MonoGame/MonoGame/pull/4997

I’m getting this same error here for MonoGame version 3.7.1.189, trying to load an android asset:

Stacktrace:
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) object.wrapper_native_0xb690e8dd (MonoGame.OpenGL.TextureTarget,int) <0x00012>
  at Microsoft.Xna.Framework.Graphics.Texture2D.GenerateGLTextureIfRequired () [0x0005b] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Graphics.Texture2D/<>c__DisplayClass1.<PlatformConstruct>b__0 () [0x00006] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Threading.BlockOnUIThread (System.Action) [0x0002d] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Graphics.Texture2D.PlatformConstruct (int,int,bool,Microsoft.Xna.Framework.Graphics.SurfaceFormat,Microsoft.Xna.Framework.Graphics.Texture2D/SurfaceType,bool) [0x00064] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Graphics.Texture2D..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice,int,int,bool,Microsoft.Xna.Framework.Graphics.SurfaceFormat,Microsoft.Xna.Framework.Graphics.Texture2D/SurfaceType,bool,int) [0x000ca] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Graphics.Texture2D..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice,int,int,bool,Microsoft.Xna.Framework.Graphics.SurfaceFormat) [0x0000b] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.Texture2DReader.Read (Microsoft.Xna.Framework.Content.ContentReader,Microsoft.Xna.Framework.Graphics.Texture2D) [0x001a6] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.ContentTypeReader`1<T_REF>.Read (Microsoft.Xna.Framework.Content.ContentReader,object) [0x0000e] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject<T_REF> (T_REF) [0x00035] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.ContentReader.ReadObject<T_REF> () [0x0000a] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.SpriteFontReader.Read (Microsoft.Xna.Framework.Content.ContentReader,Microsoft.Xna.Framework.Graphics.SpriteFont) [0x0004c] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.ContentTypeReader`1<T_REF>.Read (Microsoft.Xna.Framework.Content.ContentReader,object) [0x0000e] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject<T_REF> (T_REF) [0x00035] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.ContentReader.ReadObject<T_REF> () [0x0000a] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset<T_REF> () [0x00007] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset<T_REF> (string,System.Action`1<System.IDisposable>) [0x00082] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Engine.Program/CustomContentManager.Load<T_REF> (string) [0x00002] in D:\Projects\EngineCS\ALL\Program.cs:357
  at Engine.Font.CreateGraphics () [0x0003d] in D:\Projects\EngineCS\ALL\Font.cs:255
  at Engine.Program.LoadMainFont () [0x00177] in D:\Projects\EngineCS\ALL\Program.cs:562
  at Engine.Program.LoadContent () [0x00001] in D:\Projects\EngineCS\ALL\Program.cs:480
  at Microsoft.Xna.Framework.Game.Initialize () [0x00048] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Engine.Program.Initialize () [0x000c9] in D:\Projects\EngineCS\ALL\Program.cs:274
  at Microsoft.Xna.Framework.Game.DoInitialize () [0x0002d] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.AndroidGamePlatform.BeforeUpdate (Microsoft.Xna.Framework.GameTime) [0x0000e] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Game.DoUpdate (Microsoft.Xna.Framework.GameTime) [0x0000d] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.Game.Tick () [0x001f6] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.AndroidGameWindow.OnUpdateFrame (object,Microsoft.Xna.Framework.MonoGameAndroidGameView/FrameEventArgs) [0x00047] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.MonoGameAndroidGameView.UpdateFrameInternal (Microsoft.Xna.Framework.MonoGameAndroidGameView/FrameEventArgs) [0x00017] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.MonoGameAndroidGameView.UpdateAndRenderFrame () [0x0005f] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.MonoGameAndroidGameView.processStateRunning (System.Threading.CancellationToken) [0x0005c] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.MonoGameAndroidGameView.RunIteration (System.Threading.CancellationToken) [0x000e2] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Microsoft.Xna.Framework.MonoGameAndroidGameView/<>c__DisplayClasse.<WorkerThreadFrameDispatcher>b__c (object) [0x00017] in <14285e7be6444bda94a4048e3cb68e5b>:0
  at Android.App.SyncContext/<>c__DisplayClass3_0.<Send>b__0 () [0x00000] in /Users/builder/data/lanes/6102/8255f42f/source/monodroid/external/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:51
  at Java.Lang.Thread/RunnableImplementor.Run () [0x00008] in /Users/builder/data/lanes/6102/8255f42f/source/monodroid/external/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
  at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/6102/8255f42f/source/monodroid/external/xamarin-android/src/Mono.Android/obj/Release/android-28/mcw/Java.Lang.IRunnable.cs:81
  at (wrapper dynamic-method) object.17 (intptr,intptr) [0x00011] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
  at (wrapper native-to-managed) object.17 (intptr,intptr) [0x00021] in <d4a23bbd2f544c30a48c44dd622ce09f>:0