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

Pipeline crashes when adding references #6942

Open
QuinnBast opened this issue Nov 14, 2019 · 19 comments
Open

Pipeline crashes when adding references #6942

QuinnBast opened this issue Nov 14, 2019 · 19 comments

Comments

@QuinnBast
Copy link

QuinnBast commented Nov 14, 2019

Creating new issue because nobody is re-opening #6676.

Adding any reference to the monogame pipeline tool will cause the Monogame pipeline to crash with the following error:

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at MonoGame.Tools.Pipeline.PipelineTypes.ResolveAssemblies(IEnumerable`1 assemblyPaths)
   at MonoGame.Tools.Pipeline.PipelineTypes.Load(PipelineProject project)
   at MonoGame.Tools.Pipeline.PipelineController.ResolveTypes()
   at MonoGame.Tools.Pipeline.PipelineController.OnReferencesModified()
   at MonoGame.Tools.Pipeline.CellRefs.Edit(PixelLayout control)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at MonoGame.Tools.Pipeline.Program.Main(String[] args)

Steps to reproduce

  1. Create a new empty monogame project (Android)
  2. Install Monogame.Extended and Monogame.Extended.Gui and Monogame.Extended.Content.Pipeline (Using these libraries as examples. Any other library with a content pipeline dll will cause the crash as well).
  3. Find the "Content.mgcb" file. Open it with the monogame pipeline tool. Click the "Content" root. In the bottom left properties click "References", "Add".
  4. find: "packages\MonoGame.Extended.Content.Pipeline.3.7.0\lib\netstandard2.0\MonoGame.Extended.Content.Pipeline.dll" and add it as a reference.
  5. Click OK. Crash above will appear.

Related issues with the exact same error:

Issue Date Opened
#5944 Sept 15, 2017
#6443 Sept 26, 2018
#6509 October 22, 2018
#6567 Nov 28th, 2018
Forum#11697 July 3, 2019
GeonBit#107 May 26, 2019
Forum#11930 October 19, 2019

I think these are all related to PR #6566?

What version of MonoGame does the bug occur on:

  • MonoGame 3.7.1, MonoGame 3.8.0.848, Latest dev

What operating system are you using:

  • Windows
  • Can confirm it is happening on Mac as well

What MonoGame platform are you using:

Android & iOS. Don't think it matters though. Effects all platforms.

@mrhelmut
Copy link
Contributor

Are you building MonoGame from source or are you downloading the installer? The installer is currently lagging behind a bunch of updates because the repository is currently being refactored and the continuous integration is turned off.

@harry-cpp
Copy link
Member

Are you building MonoGame from source or are you downloading the installer? The installer is currently lagging behind a bunch of updates because the repository is currently being refactored and the continuous integration is turned off.

Its not turned off, its still working normally.

@mrhelmut
Copy link
Contributor

Its not turned off, its still working normally.

I missed that entirely.

@QuinnBast
Copy link
Author

QuinnBast commented Nov 14, 2019

I've been using the releases and dev builds from the installer found on the official website. Would these not be the same as the latest .exe on github?

If there's issues with the installers I feel like this should be indicated somewhere. Should I try installing from the source? The installers show the correct version when ran and they are created from the source code so I feel the installer isn't the problem but I could be wrong.

@mrhelmut
Copy link
Contributor

Nah, you can ignore my comment.

The release page on github is the same as the download page on the website.
The nightly installer on the download page is based on the latest develop branch, which is very up to date.

If you had this issue with the nightly installer, then it's legit.

@ollipekka
Copy link

ollipekka commented Nov 17, 2019

With the develop pipeline tool I get:
###redacted###/panel_default_md.xml: error: Importer 'XmlImporter' had unexpected failure! System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown. Could not resolve type with token 0100005a from typeref (expected class 'Mono.Security.Interface.IMonoSslStream2' in assembly 'Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756') assembly:Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756 type:Mono.Security.Interface.IMonoSslStream2 member:(null) Could not resolve type with token 01000067 from typeref (expected class 'Mono.Security.Interface.IMonoAuthenticationOptions' in assembly 'Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756') assembly:Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756 type:Mono.Security.Interface.IMonoAuthenticationOptions member:(null) Could not resolve type with token 0100005c from typeref (expected class 'Mono.Security.Interface.IMonoSslClientAuthenticationOptions' in assembly 'Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756') assembly:Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756 type:Mono.Security.Interface.IMonoSslClientAuthenticationOptions member:(null) Could not resolve type with token 0100005d from typeref (expected class 'Mono.Security.Interface.IMonoSslServerAuthenticationOptions' in assembly 'Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756') assembly:Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756 type:Mono.Security.Interface.IMonoSslServerAuthenticationOptions member:(null) at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool) at System.Reflection.Assembly.GetTypes () [0x00000] in <8786ba7ca96d408c8c0d5c5e15ea3164>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateSerializer+<>c.<FindType>b__15_0 (System.Reflection.Assembly assembly) [0x00000] in <3f718b846df5472db2344ff2b55aa741>:0 at System.Linq.Enumerable+<SelectManyIterator>d__1673[TSource,TCollection,TResult].MoveNext () [0x0004e] in <37ccc114b5274ac29377b3ce6f3ed359>:0
at System.Linq.Enumerable+WhereSelectEnumerableIterator2[TSource,TResult].MoveNext () [0x00059] in <37ccc114b5274ac29377b3ce6f3ed359>:0 at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Boolean& found) [0x00045] in <37ccc114b5274ac29377b3ce6f3ed359>:0
at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable1[T] source) [0x00000] in <37ccc114b5274ac29377b3ce6f3ed359>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateSerializer.FindType (System.String typeName) [0x00202] in <3f718b846df5472db2344ff2b55aa741>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadTypeName () [0x00012] in <3f718b846df5472db2344ff2b55aa741>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadObject[T] (Microsoft.Xna.Framework.Content.ContentSerializerAttribute format, Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.ContentTypeSerializer typeSerializer, T existingInstance) [0x0009f] in <3f718b846df5472db2344ff2b55aa741>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadObject[T] (Microsoft.Xna.Framework.Content.ContentSerializerAttribute format) [0x00017] in <3f718b846df5472db2344ff2b55aa741>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateSerializer.Deserialize[T] (System.Xml.XmlReader input, System.String referenceRelocationPath) [0x00053] in <3f718b846df5472db2344ff2b55aa741>:0 at Microsoft.Xna.Framework.Content.Pipeline.XmlImporter.Import (System.String filename, Microsoft.Xna.Framework.Content.Pipeline.ContentImporterContext context) [0x00007] in <3f718b846df5472db2344ff2b55aa741>:0 at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter1[T].Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import (System.String filename, Microsoft.Xna.Framework.Content.Pipeline.ContentImporterContext context) [0x0001c] in <3f718b846df5472db2344ff2b55aa741>:0
at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent (MonoGame.Framework.Content.Pipeline.Builder.PipelineBuildEvent pipelineEvent) [0x00079] in <3f718b846df5472db2344ff2b55aa741>:0`

With the bog standard 3.7.1 i get
####redacted####/slider_default_md.xml: error: Importer 'XmlImporter' had unexpected failure! System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown. Could not resolve type with token 01000161 from typeref (expected class 'System.Security.Cryptography.X509Certificates.INativeCertificateHelper' in assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') assembly:mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.Security.Cryptography.X509Certificates.INativeCertificateHelper member:(null) at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool) at System.Reflection.Assembly.GetTypes () [0x00000] in <8786ba7ca96d408c8c0d5c5e15ea3164>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateSerializer+<>c.<FindType>b__15_0 (System.Reflection.Assembly assembly) [0x00000] in <b45001942c6a4fef9c4f1ea6659439e0>:0 at System.Linq.Enumerable+<SelectManyIterator>d__1673[TSource,TCollection,TResult].MoveNext () [0x0004e] in :0
at System.Linq.Enumerable+WhereSelectEnumerableIterator2[TSource,TResult].MoveNext () [0x00059] in <f7cad77794fc4fa5bf9a33531f4b94b4>:0 at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Boolean& found) [0x00045] in :0
at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable1[T] source) [0x00000] in <f7cad77794fc4fa5bf9a33531f4b94b4>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateSerializer.FindType (System.String typeName) [0x00202] in <b45001942c6a4fef9c4f1ea6659439e0>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadTypeName () [0x00012] in <b45001942c6a4fef9c4f1ea6659439e0>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadObject[T] (Microsoft.Xna.Framework.Content.ContentSerializerAttribute format, Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.ContentTypeSerializer typeSerializer, T existingInstance) [0x0009f] in <b45001942c6a4fef9c4f1ea6659439e0>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadObject[T] (Microsoft.Xna.Framework.Content.ContentSerializerAttribute format) [0x00017] in <b45001942c6a4fef9c4f1ea6659439e0>:0 at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateSerializer.Deserialize[T] (System.Xml.XmlReader input, System.String referenceRelocationPath) [0x00053] in <b45001942c6a4fef9c4f1ea6659439e0>:0 at Microsoft.Xna.Framework.Content.Pipeline.XmlImporter.Import (System.String filename, Microsoft.Xna.Framework.Content.Pipeline.ContentImporterContext context) [0x00007] in <b45001942c6a4fef9c4f1ea6659439e0>:0 at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter1[T].Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import (System.String filename, Microsoft.Xna.Framework.Content.Pipeline.ContentImporterContext context) [0x0001c] in :0
at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent (MonoGame.Framework.Content.Pipeline.Builder.PipelineBuildEvent pipelineEvent) [0x00079] in :0
System.TypeLoadException: Could not resolve type with token 01000161 from typeref (expected class 'System.Security.Cryptography.X509Certificates.INativeCertificateHelper' in assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') assembly:mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.Security.Cryptography.X509Certificates.INativeCertificateHelper member:(null)
`

I was able to use 3.7.1 previously (I think). Perhaps this came with mono upgrade?

edit:

Looks like develop also broke OggImporter and WavImporter.

@OpenPachinko
Copy link

OpenPachinko commented Dec 11, 2019

Set the reference on Windows.
Open the project on Mac,
Crash when trying to add more references.

Perhaps the cause of the problem is that the "directory separator" is different for each OS.

@Mystiick
Copy link

Mystiick commented Dec 11, 2019

@QuinnBast I was having the same issue with referencing MonoGame.Extended.Content.Pipeline.dll, and resolved it by adding MonoGame.Extended.dll and MonoGame.Extended.Tiled.dll to the same folder as the .Pipeline.dll I was trying to reference.

I pulled down the Pipeline code, and it was failing at PipelineTypes.cs @ 436. The LoaderExceptions had a bunch of unresolved dependencies on .Extended and .ExtendedTiled. It would be nice if we were able to see these unresolved dependencies, instead of a generic message killing process.

edit: Screenshot of the exception from pipeline.exe:
image

@nkast
Copy link
Contributor

nkast commented Dec 11, 2019

it's because nuget downloads each dependency on separate directories, but .net requires the dependencies to be on the same folder. You can try adding all depending assemblies in the .mgcb references in the right order, but the best solution is to copy all .dlls in the same folder.

@QuinnBast
Copy link
Author

What if we don’t know all the .dll’s for a particular library or reference we are using? Haven’t had a chance to try Mystiick’s suggestion but this definitely used to work without needing all .dlls to be in the same folder.

@fossegutten
Copy link

fossegutten commented Feb 7, 2020

Any news on this? Did anyone test with building from source? Spent the whole evening trying to add reference dll for monogame extended. Can't get it to work. I get a similar error to this.

Edit, i put the DLL files dependent on eachother in one folder, and error message disappeared afterwards. Not the cleanest solution, but hey it works

@QuinnBast
Copy link
Author

Sadly still broken. I've also been wanting to use monogame extended but haven't been able to. Might switch to unity or unreal...

@fossegutten
Copy link

This should probably be a priority along with getting a project setup / installation guide for Visual Studio 2019.
Stuff like this throws away new users and it is easier to for example download Godot Engine, that is just an .exe file you can double click, and you're ready to start coding gameplay.
Unfortunately my skills are not sufficient to help, or I would try.

@chrisevans9629
Copy link
Contributor

This seems really odd for the content pipeline to be managing it's own references. Why not have the pipeline use the references from the project file? There's already really great API's that allow you to get all the references needed using the Roslyn API. Then the content pipeline would support nuget and be future proofed (#6879).

Currently this is how references for the pipeline are setup:

/reference:..\..\..\..\..\.nuget\packages\monogame.extended.content.pipeline\3.7.0\lib\netstandard2.0\MonoGame.Extended.Content.Pipeline.dll

What if we could do something like this?

/project:..\monogameproject.csproj

@ollipekka
Copy link

I've been trying to run this from source, and it doesn't work either.

I think there are two separate problems:

  1. Issue with references not working
  2. Xml inmpatibility with latest mono.

I was hoping that #2 would have been solved by running the develop branch from source, but no. Furthermore, the new versions on OSX have broken path handling. At least when I tried it, it generated the files in completely unexpected place.

@jrunestone
Copy link

This issue is very important to us as well. We want to reference our assembly with content importers that in turn references a couple of nugets, but they reside in the nuget store on the machine and I really really don't want to start copy them over just to build content. Surprisingly, adding all references in order doesn't work either.

Another solution is to point to the references in the bin directory of the final executable, since all nugets get copied there, but it's not very pretty and it requires the project to be built before the MGCB build happens and I'm not quite sure how to do that.

@skyeredwood
Copy link

Still getting this issue two years later, did anyone find a solution / has this been resolved?

@nkast
Copy link
Contributor

nkast commented Dec 30, 2022

@abodactyl
The steps (1-5) described here are not going to work. Content is build before the main c# project. The packages are never resolved.
It's possible to create a dummy project and add a depedency just for resolving the packages, but that to me just sounds like more extra steps.

@nkast
Copy link
Contributor

nkast commented Dec 30, 2022

See if the authors provide a .zip file with the processor library. Otherwish you have to either build it ourself or install the nuget manually from the command line and copy the dll from your local nuget store.

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