Operation is not valid due to the current state of the object?

Posted by Bill on Stack Overflow See other posts from Stack Overflow or by Bill
Published on 2010-06-17T17:51:47Z Indexed on 2010/06/17 18:23 UTC
Read the original article Hit count: 310

Filed under:
|

I am programming in C#; the code was working about a week ago, however it throws an exception and I don't understand at all what could be wrong with it.

Var root = new CalculationNode(); -> Throw exception.

In the call stack thats the only thing listed, I've been told that it could be that I need a clean build, but I am open to any ideas or suggestions.

Thanks, -Bill

Update: Exception's Detail

System.InvalidOperationException was unhandled by user code Message=Operation is not valid due to the current state of the object. Source=Calculator.Logic StackTrace: at ~.Calculator.Logic.MyBaseExpressionParser.Parse(String expression) in ~\Source\Calculator.Logic\MyBaseExpressionParser.cs:line 44 at ~.Calculator.Logic.Tests.MyBaseCalculatorServiceTests.BasicMathDivision() in ~\Projects\Tests\Calculator.Logic.Tests\MyBaseCalculatorServiceTests.cs:line 60 InnerException:

CalculationNode's code:

public sealed calss CalculationNode
{
 public CalculationNode()
{
this.Left = null;
this.Right = null;
this.Element = new CalculationElement();
}

public CalculationNode Left {get;set;}

public CalculationNode Right {get;set;}

public CalculationElement Element {get; set;}
}

CalculationElement's code:

public sealed class CalculationElement
{
 public CalculationElement()
{
Value = string.Empty;
IsOperator = false;
}

public string Value {get; set}

public bool IsOperator {get; set}
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about exception