[Bug v5.02.03]: COMException while debugging
Hi !
please paste the code below in a C# Program editor window. Then hit F10 (to step to the first line) and then F11 (to step into the call of PluginDataStructFromXmlElement.. method). An System.Runtime.InteropServices.COMException is thrown. Can you repro this?
Thanks
KarloX
----------------------------------------------------
please paste the code below in a C# Program editor window. Then hit F10 (to step to the first line) and then F11 (to step into the call of PluginDataStructFromXmlElement.. method). An System.Runtime.InteropServices.COMException is thrown. Can you repro this?
Thanks
KarloX
----------------------------------------------------
public interface IInitialize
{
void SetDefaults();
}
public struct Parameter : IInitialize
{
public int i;
public void SetDefaults()
{
i = 42;
}
}
protected T PluginDataStructFromXmlElement(XmlElement xmlElement) where T : IInitialize
{
var retval = default(T);
retval.SetDefaults();
return retval;
}
void Main()
{
var p = PluginDataStructFromXmlElement(null);
p.Dump();
}
Comments
void Main(){ Method(null); } void Method(XmlElement xmlElement){ throw new Exception(); }
I'm guessing it's caused by the way the debugger is handling the null xmlElement. The error does not happen when debugging is off.
Tested with v5.03.03(AnyCPU)
http://www.linqpad.net/download.aspx#beta