martindevans / Cassowary.net

An incremental constraint solver for .NET
http://jozilla.net/Software/CassowaryNet
GNU Lesser General Public License v2.1
3 stars 5 forks source link

KeyNotFoundException when editing stay variable #2

Closed LuizZak closed 4 years ago

LuizZak commented 4 years ago

The following minimal sample raises a System.Collections.Generic.KeyNotFoundException

var value = new ClVariable("value", 0);

var solver = new ClSimplexSolver();

solver.AddStay(value, ClStrength.Strong);

solver.BeginEdit(value)
    .SuggestValue(value, 25)
    .EndEdit(); // <- Exception raised here

Full stack trace:

Test method PixUITests.LayoutSystem.LayoutConstraintSolverTests.TestMinimal threw exception: 
System.Collections.Generic.KeyNotFoundException: A chave fornecida não estava presente no dicionário.
    em System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   em Cassowary.ClLinearExpression.AddVariable(ClAbstractVariable v, Double c, ClAbstractVariable subject, ClTableau solver)
   em Cassowary.ClSimplexSolver.RemoveConstraint(ClConstraint cn)
   em Cassowary.ClSimplexSolver.RemoveEditVar(ClVariable v)
   em Cassowary.ClSimplexSolver.RemoveEditVarsTo(Int32 n)
   em Cassowary.ClSimplexSolver.Cassowary.IEditContext.EndEdit()
   em PixUITests.LayoutSystem.LayoutConstraintSolverTests.TestMinimal()