Vixen
dd8b0a81
csharp
public sealed class ImporterContributions

Importers something other than this build contributed — a plugin, a project script.

Read the guide page for this →

Remarks

Doc 36 § F8's fix. That finding said "importers are constructed and handed in; there is no registry for a plugin to add to", and the second half was the part that mattered: ImporterRegistry has existed all along, but it is built fresh per run by Create — inside a background task, deliberately, so that the editor and the CLI cannot disagree about the set. A plugin had nothing to add to because every registry it could have reached was about to be thrown away.

⚠ What was needed is a set that outlives a run, which is this, folded in by Create. EditorApplication's own remark said exactly that and named this assembly as where the change belonged; this is that change.

⚠ Process-wide, and unlike EditorRegistry it has to be. The consumers are static factories called from background tasks with no editor to be handed — ProjectWorkspace.Importers(), ContentPipeline, Vixen.Cli — and a per-session registry would reach none of them. What makes that safe is that Add hands back the removal: a plugin's scope disposes it on unload, and a test disposes it in a finally. An editor that shut down without withdrawing its contributions would leave an importer naming a type in an unloaded assembly, which is F8's own trap one level down.

✅ A contributed importer reaches an out-of-process compiler worker now, and the change was the one this remark asked for. It used to say a worker's Default is empty because that process never loaded the plugin, so an asset only that plugin can import failed there. CompilerPool reads the files its coordinator's contributed importers came out of and names each on the worker's command line, and PluginImporters loads them at the far end — so the worker's registry is assembled from the same assemblies without either process caching a set. Doc 36 § Part 6.

⚠ One shape still cannot cross: an importer whose assembly has no file. A plugin is a .dll and a project's editor scripts are compiled to one, so both have a path — but there is nothing to name for an importer contributed from a dynamic assembly. CompilerPool.UnreachableImporters is the list, said out loud rather than left to be discovered as an asset that imported as a byte blob.

Fields and properties (2)

Methods (3)

  • public IDisposable Add(IAssetImporter importer)

    Contributes an importer.

  • public void Clear()

    Forgets everything contributed. For a test that wants a clean process.

  • public ImporterRegistry ApplyTo(ImporterRegistry registry)

    Adds every contribution to a registry.

Used by (18)

  • BuiltInImportersVixen.Editor.Assets
  • CompilerPoolVixen.AssetCompiler
  • CubeLutTestsVixen.Editor.Assets.Tests
  • EditorApplicationVixen.Editor.App
  • EditorScriptTestsVixen.Editor.Scripts.Tests
  • EveryAttributedImporterTestsVixen.Editor.Assets.Tests
  • ImporterContributionTestsVixen.Editor.Assets.Tests
  • NetworkRulesImporterTestsVixen.Editor.Assets.Tests
  • OutOfTreePluginTestsVixen.Editor.App.Tests
  • PluginImporterTestsVixen.AssetCompiler.Tests
  • PluginImportersVixen.AssetCompiler
  • ProjectPluginsVixen.Cli
  • RemovalVixen.Editor.Assets
  • ScriptModuleVixen.Editor.Scripts
  • UnclaimedPlacementExtensionTestsVixen.Editor.Assets.Tests
  • UnimportedFormatTestsVixen.Editor.Assets.Tests
  • WaterWavesImporterTestsVixen.Editor.Assets.Tests
  • WorkerHostVixen.AssetCompiler