Recently I have been working with C# and I ran into this curious problem. I tried to set a value to the read-only property of the excel chart class, before I read the documentation and discovered that the property is read-only.
var charts= worksheet.ChartObjects() as xcel.ChartObjects;
var chartObj = charts.Add(60,10,200,400) as xcel.ChartObject;
var chart = chartObj.Chart;
chart.Name = "GicsSectorIndustry"; <--
I get this error:
Insufficient memory to continue the execution of the program
When I remove that line, the code works perfectly, so it led me to wonder what happens behind the scenes when I try to set a value for the read-only property that causes it to "run out of memory".