stride3d/stride · error · InvalidOperationException

Missing mscorlib.dll from assembly

Error message

Missing mscorlib.dll from assembly

What it means

ParameterKeyProcessor.Process locates the coroutine/mscorlib assembly via FindCorlibAssembly and throws this InvalidOperationException if it cannot be found; the processor needs core types (Type, object, attribute constructors) from the corlib to generate parameter-key merge methods.

Solutions

  1. Ensure the processed project targets a supported framework and references the proper runtime (mscorlib/System.Private.CoreLib)
  2. Clean and rebuild the solution so assembly references are complete
  3. Verify AssemblyProcessor setup (Stride targets/props) so the assembly is compiled with normal SDK references
  4. Avoid processing assemblies manually stripped of framework references

Example fix

// before (csproj)
<TargetFramework>netstandard1.1</TargetFramework>
// after
<TargetFramework>net8.0</TargetFramework> <!-- standard framework with corlib reference -->
Defensive patterns

Strategy: validation

Validate before calling

var corlib = CecilExtensions.FindCorlibAssembly(assembly);
if (corlib == null) throw new InvalidOperationException("Assembly lacks a corlib reference; cannot process");

Try / catch

catch (InvalidOperationException ex) when (ex.Message == "Missing mscorlib.dll from assembly")
{
    // fix target framework / rebuild with standard SDK references
}

Prevention

When it happens

Trigger: Running AssemblyProcessor on an assembly whose referenced corlib cannot be resolved by FindCorlibAssembly (missing or non-standard mscorlib/System.Private.CoreLib reference).

Common situations: Processing assemblies compiled against unusual targets or trimmed AOT profiles lacking a corlib reference; referencing wrong framework (e.g. netstandard facade issues); corrupted build outputs missing assembly references.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/9274bc953f4972ae. Report an issue: GitHub.

Appendix: source

Thrown at sources/core/Stride.Core.AssemblyProcessor/ParameterKeyProcessor.cs:21

using System.Runtime.CompilerServices;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Cecil.Rocks;
using MethodAttributes = Mono.Cecil.MethodAttributes;

namespace Stride.Core.AssemblyProcessor;

internal class ParameterKeyProcessor : IAssemblyDefinitionProcessor
{
    public bool Process(AssemblyProcessorContext context)
    {
        var assembly = context.Assembly;
        var fields = new List<FieldDefinition>();

        var mscorlibAssembly = CecilExtensions.FindCorlibAssembly(assembly);
        if (mscorlibAssembly == null)
            throw new InvalidOperationException("Missing mscorlib.dll from assembly");

        MethodDefinition parameterKeysMergeMethod = null;
        TypeDefinition assemblyEffectKeysAttributeType = null;
        var getTypeFromHandleMethod = new Lazy<MethodReference>(() =>
        {
            // Find Type.GetTypeFromHandle
            var typeType = mscorlibAssembly.MainModule.GetTypeResolved(typeof(Type).FullName);
            return assembly.MainModule.ImportReference(typeType.Methods.First(x => x.Name == "GetTypeFromHandle"));
        });

        var effectKeysStaticConstructors = new List<MethodReference>();
        var effectKeysArrayElemementTypes = new HashSet<TypeReference>();

        foreach (var type in assembly.MainModule.GetTypes())
        {
            fields.Clear();

            foreach (var field in type.Fields.Where(x => x.IsStatic))

View on GitHub (pinned to 96fad776d2)