J
Jochen Kalmbach
Hello,
if an PrinterSettings-Instance is not set-up correctly (for example just
by using the default-constructor), then the "ToString()"_method will
throw an exception!
Unhandled Exception: System.ArgumentException: The value '0' is not a
valid value for the enum 'Duplex'.
at System.ComponentModel.EnumConverter.ConvertTo(ITypeDescriptorContext
context, CultureInfo culture, Object value, Type destinationType)
at System.ComponentModel.TypeConverter.ConvertToString(Object value)
at System.Drawing.Printing.PrinterSettings.ToString()
at PrinterSettingsBug_CS.Class1.Main(String[] args)
Here is a simple example to reproduce the problem:
<code>
namespace PrinterSettingsBug_CS
{
class Class1
{
[System.STAThread]
static void Main(string[] args)
{
System.Drawing.Printing.PrinterSettings ps = new
System.Drawing.Printing.PrinterSettings();
System.Console.WriteLine(ps.ToString()); // <===== Exception *****
}
}
}
</code>
--
Greetings
Jochen
Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp
if an PrinterSettings-Instance is not set-up correctly (for example just
by using the default-constructor), then the "ToString()"_method will
throw an exception!
Unhandled Exception: System.ArgumentException: The value '0' is not a
valid value for the enum 'Duplex'.
at System.ComponentModel.EnumConverter.ConvertTo(ITypeDescriptorContext
context, CultureInfo culture, Object value, Type destinationType)
at System.ComponentModel.TypeConverter.ConvertToString(Object value)
at System.Drawing.Printing.PrinterSettings.ToString()
at PrinterSettingsBug_CS.Class1.Main(String[] args)
Here is a simple example to reproduce the problem:
<code>
namespace PrinterSettingsBug_CS
{
class Class1
{
[System.STAThread]
static void Main(string[] args)
{
System.Drawing.Printing.PrinterSettings ps = new
System.Drawing.Printing.PrinterSettings();
System.Console.WriteLine(ps.ToString()); // <===== Exception *****
}
}
}
</code>
--
Greetings
Jochen
Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp