Skip to content

Crash in RenderingContext.CopyTo #227

@craigfowler

Description

@craigfowler

The class RenderingContext has a crash bug in its CopyTo method, due to a copy-paste error. The copy of METAL definitions accidentally makes use of the TAL dictionary.

var talDefinitions = TalModel.GetAllDefinitions();
var metalDefinitions = MetalModel.GetAllDefinitions();

foreach(var key in talDefinitions.Keys)
{
  container.TalModel.AddLocal(key, talDefinitions[key]);
}

foreach(var key in metalDefinitions.Keys)
{
  // Here is the error - that should be metalDefinitions below, not talDefinitions
  container.MetalModel.AddLocal(key, talDefinitions[key]);
}

This can cause it to crash with KeyNotFoundException in the dictionary access.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working and should be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions