<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
thanks for the reply Dino, If I get any additional info &nbsp;about it, I'll post it.&nbsp;<div><br></div><div>In one application (which triggered the error you mentioned it) Im using an asp.net timer. That runs in another thread, right?</div><div><br></div><div>Greetings, Pablo<br><div><br></div><div><br><br><hr id="stopSpelling">From: dinov@microsoft.com<br>To: users@lists.ironpython.com<br>Date: Wed, 13 Oct 2010 19:47:04 +0000<br>Subject: Re: [IronPython] expected behavior of the module copy with .net objects<br><br>

<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">


<style>
.ExternalClass p.ecxMsoNormal, .ExternalClass li.ecxMsoNormal, .ExternalClass div.ecxMsoNormal
{margin-bottom:.0001pt;font-size:12.0pt;font-family:'Times New Roman','serif';}
.ExternalClass a:link, .ExternalClass span.ecxMsoHyperlink
{color:blue;text-decoration:underline;}
.ExternalClass a:visited, .ExternalClass span.ecxMsoHyperlinkFollowed
{color:purple;text-decoration:underline;}
.ExternalClass p
{margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:'Times New Roman','serif';}
.ExternalClass span.ecxEmailStyle18
{font-family:'Calibri','sans-serif';color:#1F497D;}
.ExternalClass .ecxMsoChpDefault
{font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;}
.ExternalClass div.ecxWordSection1
{page:WordSection1;}

</style>


<div class="ecxWordSection1">
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D">I think as of now copy is certainly not suitable for all .NET objects.&nbsp; For starters not all .NET objects are serializable/copyable.&nbsp; There should probably
 be some effort to close the gaps where it makes sense.&nbsp; For example something which implements ICloneable could have a __copy__ method added to it.&nbsp; This is similar to how we add a __reduce_ex__ method for things which implement ISerializable.&nbsp; But if something
 doesn’t implement either of these interfaces then there’s no standard way for us to copy these objects.</span></p>
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D">&nbsp;</span></p>
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D">If you have specific object types which you know you need to copy I would suggest registering the type with copy_reg.&nbsp; That should at least give you a solution
 for your specific scenarios.&nbsp; </span></p>
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D">&nbsp;</span></p>
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D">You also mentioned the null reference exception (“object reference not set to object instance…”).&nbsp; That sounds like a bug – I would guess you’re running in
 a multi-threaded environment?&nbsp; If you could get a repro of this that’d be great as it looks like it could be an issue w/ our dictionary implementation not being thread safe.</span></p>
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D">&nbsp;</span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="ecxMsoNormal"><b><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">From:</span></b><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'"> users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com]
<b>On Behalf Of </b>Pablo Dalmazzo<br>
<b>Sent:</b> Wednesday, October 13, 2010 11:51 AM<br>
<b>To:</b> IronPython Mailing list<br>
<b>Subject:</b> [IronPython] expected behavior of the module copy with .net objects</span></p>
</div>
</div>
<p class="ecxMsoNormal">&nbsp;</p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">Hi guys,</span></p>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">Sorry for being annoying about this but I just want to know where I'm standing at :)</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">It would seem to me the copy module has some problems copying .net objects in general. I was wondering if I'm pretending too much for that&nbsp;module and it will never fully copy
 &nbsp;objects instantiated from .net classes, or it's a goal &nbsp;for it to do it someday, or I just happened to find a couple of errors,&nbsp;or Im not using it rightly for what it was meant to be. I dont know 5% of what you know so it's an honest question :)</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">Aside there are a couple of errors I cant reproduce, and that it didnt copy System.DBNull , now I see it loses property values when copying</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">a System.Data.SqlConnection object, properties such as "DataSource", "DataBase", etc. they get empty strings after being copied. Just in case</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">I tried with the original version of the module/file copy. I guess you have thousands of things to check but I just want to know, it's the module supposed&nbsp;to copy any object
 instantiated from .net classes or it's only supposed to fully work only for custom made classes?</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">Greetings, Pablo Dalmazzo</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">P.S: sorry about insisting again with this but I've also added another example where it seems to fail :)</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">&nbsp;</span></p>
</div>
</div>
</div>


<br>_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</div></div>                                               </body>
</html>