Skip to content

Breaking Changes in MonoGame Content Pipeline Broke Custom Content Importer/Processor Handling #1089

Description

@uygary

Description

There is a breaking change to how content importers and content processors are handled in MonoGame content pipeline, with the current preview build (MonoGame 3.8.5-preview.2).
This function is now deprecated, marked as obsolete, and it's throwing a NotSupportedException.

When attempting to use a custom ContentImporter and a custom ContentProcessor implementation, the new content builder calls into an obsolete method, instead of using the passed in instances, which in turn throws an exception.
Rgith now, there doesn't seem to be a way to use custom content importers or processors using what's available on the TiledMapTilesetImporter, TiledMapImporter, TiledMapTilesetProcessor and TiledMapProcessor in order to load Tiled maps, the content pipeline now breaks, failing to load Tiled maps.

Steps to Reproduce

Update MonoGame dependencies to 3.8.5-preview.2 in an existing project in order to use the new content build tool, or create a new solution using the MonoGame template via the dotnet tool: dotnet new mg2dmgcbstartkit

Then use this Builder example:

using Microsoft.Xna.Framework.Content.Pipeline;
using MonoGame.Extended.Content.Pipeline.Tiled;
using MonoGame.Framework.Content.Pipeline.Builder;

var contentCollectionArgs = new ContentBuilderParams()
{
    Mode = ContentBuilderMode.Builder,
    WorkingDirectory = $"{AppContext.BaseDirectory}../../../",
    SourceDirectory = "Assets",
    Platform = TargetPlatform.DesktopGL,
};
var builder = new BabyDashContentBuilder();

if (args is not null && args.Length > 0)
{
    builder.Run(args);
}
else
{
    builder.Run(contentCollectionArgs);
}

return builder.FailedToBuild > 0 ? -1 : 0;

public class CustomContentBuilder : ContentBuilder
{
    public override IContentCollection GetContentCollection()
    {
        var contentCollection = new ContentCollection();

        // include everything in the folder
        contentCollection.Include<WildcardRule>("*");

        var tilesetImporter = new TiledMapTilesetImporter();
        var tilesetProcessor = new TiledMapTilesetProcessor();
        var tiledMapImporter = new TiledMapImporter();
        var tiledMapProcessor = new TiledMapProcessor();

        // By default, all content will be imported from the Assets folder using the default importer for their file type.
        // Please add any custom content collection rules here.
        contentCollection.Include<WildcardRule>("Maps/Foo/*.tsx", tilesetImporter, tilesetProcessor);
        contentCollection.Include<WildcardRule>("Maps/Foo/*.tmx", tiledMapImporter, tiledMapProcessor);

        return contentCollection;
    }
}

Expected Behavior

Tilesets and maps should be imported without an issue as was the case with the MonoGame versions prior to the preview release.

Actual Behavior

Tiled tileset and map imports break in the content pipeline.

Configuration

  • MonoGame 3.8.5-preview.2
  • MonoGame.Extended 5.3.1
  • MonoGame.Extended.Content.Pipeline 5.3.1
  • .net 10.0
  • Windows 11
  • AMD64

Other Information

Original ticket I had opened on MonoGame repo is here, with the details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken, crashes, regresses, or behaves unexpectedlyscope: content-pipelineMGCB workflows; importers/processors for atlases, fonts, animations, particles, Tiled maps

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions