dotnet/efcore · error · OperationException
Processing '{inputFile}' failed.
Error message
Processing '{inputFile}' failed. What it means
Thrown in CSharpModelGenerator.ProcessTemplate (line 124, resource ErrorGeneratingOutput -> 'Processing {inputFile} failed.') as an OperationException when a T4 text template transformation reports errors. EF scaffolding uses T4 templates (CSharpDbContextGenerator, CSharpEntityTypeGenerator) to produce code; if transformation.Errors.HasErrors is true, the generated output is discarded and this is thrown. The 'inputFile' placeholder is the transformation type name.
Source
Thrown at src/EFCore.Design/Scaffolding/Internal/CSharpModelGenerator.cs:124
// output EntityType poco .cs file
var entityTypeFileName = entityType.Name + host.Extension;
resultingFiles.AdditionalFiles.Add(new ScaffoldedFile(entityTypeFileName, generatedCode));
}
return resultingFiles;
}
private string ProcessTemplate(ITextTransformation transformation)
{
var output = transformation.TransformText();
foreach (CompilerError error in transformation.Errors)
{
_reporter.Write(error);
}
return transformation.Errors.HasErrors
? throw new OperationException(DesignStrings.ErrorGeneratingOutput(transformation.GetType().Name))
: output;
}
}
View on GitHub (pinned to dbf9771522)
Solutions
- Read the detailed CompilerError entries reported just before the exception (via the reporter) to find the template's real failure.
- Upgrade the EF Core Design package so the bundled templates match your runtime/provider version.
- Simplify the schema selection (tables/schemas filter in DatabaseModelFactoryOptions) to isolate which object triggers the template error.
- If using custom T4 templates, validate them in isolation; revert customizations to confirm they are the cause.
Defensive patterns
Strategy: try-catch
Try / catch
try { generator.GenerateModel(model, options); }
catch (OperationException ex) when (ex.Message.StartsWith("Processing"))
{ /* inspect reported CompilerErrors; fix model/version/templates; retry */ } Prevention
- Keep EF Core Design package version aligned with runtime/provider.
- Read the CompilerError details reported before the throw.
- Scope the schema filter to isolate offending objects.
- Validate custom T4 templates separately.
When it happens
Trigger: Running reverse-engineering/scaffolding where the T4 template (DbContext or entity-type generator) fails to transform, populating transformation.Errors with CompilerErrors. ProcessTemplate writes the errors to the reporter and throws OperationException(DesignStrings.ErrorGeneratingOutput(transformation.GetType().Name)).
Common situations: Template errors caused by an unexpected model shape, a provider emitting metadata the template cannot handle, an EF Core version mismatch between the template and the model, or a custom T4 host with missing assemblies. Corrupt/unusual database schema producing model annotations the generator chokes on. Customized scaffolding templates with syntax errors.
Related errors
- Couldn't find method symbol for: {memberAccessSyntax}
- Generic method on generic type not supported
- Non-extension static method not supported
- Unsupported type: {type}
- Compound assignment not supported yet.
AI-assisted analysis of dotnet/efcore@dbf9771522 (2026-08-06).
Data as JSON: /api/errors/0af9471f8377b9e7.
Report an issue: GitHub.