This project is read-only.

XAML parameterless constructor missing

Dec 27, 2012 at 6:31 PM
Edited Dec 27, 2012 at 6:36 PM

Hi, I'm trying to run some samples on Windows XP (with Visual C# 2010 Express, .NET 4 Full, XNA 4 Refresh) but I'm getting pipeline error during build:

Building content threw XamlObjectWriterException: The invocation of the constructor on type 'Nine.Graphics.SkyBox' that matches the specified binding constraints threw an exception.
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args)
   at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
   at Nine.Content.Pipeline.Xaml.ObjectWriter.WriteStartMember(XamlMember property)
   at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Nine.Content.Pipeline.Xaml.XamlSerializer.Load(Stream stream)
   at Nine.Content.Pipeline.Xaml.XamlSerializer.Load(String filename)
   at Nine.Content.Pipeline.Importers.XamlImporter.Import(String filename, ContentImporterContext context)
   at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAssetDirectly(BuildItem item, String importerName)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAsset(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
   at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[] sourceAssets, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[]& warnings)
	Inner exception: InvalidOperationException: Cannot create an instance of type Nine.Graphics.SkyBox
	   at Nine.Content.Pipeline.Xaml.XamlSerializer.ResolveInstance(Type type, Object[] arguments)
	   at Nine.Content.Pipeline.Xaml.XamlFactoryInvoker.CreateInstance(Object[] arguments)
	   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor(XamlType xamlType, Object[] args)
	   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args)

and when I open scene in xaml editor following error is added to the list:

Type 'SkyBox' is not usable as an object element because it is not public or does not define a public parameterless constructor or a type converter.

It's repeated for all objects in scene that don't have parameterless constructor. I have 1.4 version from MSI package. I've also tried to run samples on Windows Vista / 7 with Windows Phone SDK installed and everything worked fine.

Am I missing something ?


Dec 28, 2012 at 1:35 AM

I haven't test it on Windows XP with XNA 4. its not easy for me to setup such environment. So can you help me find  where  went wrong?

According to the stacktrace, it  failed when tring to call the constructor that takes a GraphicsDevice during XamlSerializer.ResolveInstance. The source code can be found at Nine.Content.Pipeline\Xaml\XamlSerializer.cs