XMLImporter failure - Unable to load one or more of the requested types

OK, back from my dev activity. Because I found another problem in pipeline.
In this case its Could not resolve Type.
I saw this in my single file test but thought it was just my ported contents.
Following searches it appears this is another old problem that was not resolved.
Digging again and noticed that we are still using
Microsoft.Xna.Framework.Content.Pipeline.
XMLImporter and Serialization
Would someone please confirm that we should be using
MonoGame.Framework.Content.Pipeline

I get the same error in one project with this code:

foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
var types = asm.GetTypes();

It looks like SharpDX.MediaFoundation has a reference to SharpDX.Mathematics but MG doesn’t distribute this dll. I solved it with a try/catch

            try
             {
                 var types = asm.GetTypes();
                 // ...
             }
             catch (ReflectionTypeLoadException rtle)
             {
                 if (asm.GetName().Name == "SharpDX.MediaFoundation") // caused by a missing SharpDX.Mathematics
                     continue;
                 throw rtle;
             }

No, it’s ok, MG has the same namespace and API with XNA but everything were re-implemented from scratch.
What is the other problem?

ref SharpDX.MediaFoundation You could try setting the Copy Local property of the SharpDX.MediaFoundation reference to Yes.
That will get a copy to your system during compile time so its distributed when used.
The unable to resolve Type message is from the Microsoft.Xna.Framework area not MonoGame. Do we have a pdb for those dll’s?

Microsoft.Xna.Framework.Storage and GamerServices don’t resolve and I don’t know what reference to use.

MonoGame uses the interop math types that are included in the core SharpDX assembly, so it doesn’t need the Mathematics assembly.
From SharpDX 3.0.0 release notes:

All Mathematics (Vector3, Vector4…) have been moved to a dedicated assembly. The reason behind this change is to put SharpDX on a diet, where higher level API (like Xenko, MonoGame…) are no longer forced to include this API. In order to support this, all SharpDX assemblies are now using interop types (RawVector3, RawVector4 from SharpDX.Mathematics.Interop namespace).

If MediaFoundation is not using those interop types we should open an issue in the SharpDX repo. If this issue still present in the develop version of MG it’s probably not fixed yet in SharpDX.

1 Like

Further to the Unable to resolve Type message from Pipeline.exe does anyone know if this tool needs to reference the projects class definitions?
If that is so where does the mgcb need to be housed?

Not much left for me to say I guess ¯_(ツ)_/¯

Ok. I have completed my initial migration from Xna to MonoGame and now need to ‘catchup’ with the latest ways of doing things. One thing I need to do is sort out the pipeline message unable to resolve type. I will do that in a new chat line as it may confuse the readers catching up.

Hey, I’ve encountered the same original problem and I believe I found a fix, for anyone who will try to troubleshoot this issue in the future.

In my case, the problem was because I copied the Content.mgcb from another project. I was wondering why any attempt of adding a reference was crashing, but then I noticed that any attempt of removing a reference was also causing a crash.

All I had to do to get around this specific exception was to craete a new Content.mgcb from the Monogame Pipeline Tool. Then, I was able to add my pipeline extension as a reference.