PInvokeStackImbalance was detected when manually running Xna Content pipeline
- by Miau
So I m running this code
static readonly string[] PipelineAssemblies =
{
"Microsoft.Xna.Framework.Content.Pipeline.FBXImporter" + XnaVersion,
"Microsoft.Xna.Framework.Content.Pipeline.XImporter" + XnaVersion,
"Microsoft.Xna.Framework.Content.Pipeline.TextureImporter" + XnaVersion,
"Microsoft.Xna.Framework.Content.Pipeline.EffectImporter" + XnaVersion,
"Microsoft.Xna.Framework.Content.Pipeline.XImporter" + XnaVersion,
"Microsoft.Xna.Framework.Content.Pipeline.AudioImporters" + XnaVersion,
"Microsoft.Xna.Framework.Content.Pipeline.VideoImporters" + XnaVersion,
};
more code in between .....
// Register any custom importers or processors.
foreach (string pipelineAssembly in PipelineAssemblies)
{
_buildProject.AddItem("Reference", pipelineAssembly);
}
more code in between .....
var execute = Task.Factory.StartNew(() => submission.ExecuteAsync(null, null), cancellationTokenSource.Token);
var endBuild = execute.ContinueWith(ant => BuildManager.DefaultBuildManager.EndBuild());
endBuild.Wait();
Basically trying to build the content project with code ... this works well if you remove XImporter, AudioIMporters and VideoImporters but with those I get the following error:
PInvokeStackImbalance was detected
Message: A call to PInvoke function 'Microsoft.Xna.Framework.Content.Pipeline!Microsoft.Xna.Framework.Content.Pipeline.UnsafeNativeMethods+AudioHelper::GetFormatSize' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Things I've tried:
turn unsafe code on
adding a lot of logging (the dll is found in case you are wondering)
different wav and Mp3 files (just in case)
Will update...