When I try to compile the code below I receive a first chance exception. I've
noticed from searching on the web that some people choose to ignore first
chance exceptions. Is this common practice? Do you guys see anything wrong
with my code or should I ignore the exception it generates?
<Using directives here>
namespace Settings
{
enum DisplacementUni ts { Feet, Kilofeet, Meters, Kilometers, NauticalMiles };
abstract class Variable
{
public abstract int Unit
{
get;
set;
}
public double Value //Using another name doesn't help
{
get
{
return Value;
}
set
{
Value = value; //Generates a A first chance exception of type
'System.StackOv erflowException '
}
}
}
class DisplacementVar iable : Variable
{
public override int Unit
{
get
{
return Unit;
}
set
{
Console.WriteLi ne("set");
}
}
public DisplacementVar iable()
{
Unit = (int)Displaceme ntUnits.Feet;
Value = 0;
}
public DisplacementVar iable(double value, int unit)
{
Unit = unit;
Value = value;
}
}
class Settings
{
double someVar1;
string someVar2;
static void Main(string[] args)
{
DisplacementVar iable x = new DisplacementVar iable(0,0);
Console.WriteLi ne("in main..");
Console.ReadLin e();
}
}
}
I'm using VS2005 beta1.
noticed from searching on the web that some people choose to ignore first
chance exceptions. Is this common practice? Do you guys see anything wrong
with my code or should I ignore the exception it generates?
<Using directives here>
namespace Settings
{
enum DisplacementUni ts { Feet, Kilofeet, Meters, Kilometers, NauticalMiles };
abstract class Variable
{
public abstract int Unit
{
get;
set;
}
public double Value //Using another name doesn't help
{
get
{
return Value;
}
set
{
Value = value; //Generates a A first chance exception of type
'System.StackOv erflowException '
}
}
}
class DisplacementVar iable : Variable
{
public override int Unit
{
get
{
return Unit;
}
set
{
Console.WriteLi ne("set");
}
}
public DisplacementVar iable()
{
Unit = (int)Displaceme ntUnits.Feet;
Value = 0;
}
public DisplacementVar iable(double value, int unit)
{
Unit = unit;
Value = value;
}
}
class Settings
{
double someVar1;
string someVar2;
static void Main(string[] args)
{
DisplacementVar iable x = new DisplacementVar iable(0,0);
Console.WriteLi ne("in main..");
Console.ReadLin e();
}
}
}
I'm using VS2005 beta1.
Comment