PDA

View Full Version : Errors accessing dotNet properties


PEN
10-23-2009, 07:59 PM
I keep getting errors accessing dotNet properties.

They are very random but are cropping up more and more as I build this tool.

What I will get are error message that say things like

Unknown property: "location" in dotNetObject:System.Windows.Forms.Form

If it just tried again it works fine. Is there something that I need to check to see if every thing is up to date at that point in the script? I don't want to start wrapping try()catch() around everything.

denisT
10-23-2009, 08:39 PM
I keep getting errors accessing dotNet properties.

They are very random but are cropping up more and more as I build this tool.

What I will get are error message that say things like

Unknown property: "location" in dotNetObject:System.Windows.Forms.Form

If it just tried again it works fine. Is there something that I need to check to see if every thing is up to date at that point in the script? I don't want to start wrapping try()catch() around everything.

could you give a sample code shows this issue?

PEN
10-23-2009, 08:48 PM
It isn't possible that is the problem. I'm getting it all over the place but it is completely random.

If you look at the error it makes no sense at all as a form has a location property. I get it on labels and other controls as well as it is trying to call controls.add and it says that the controls.add is not valid.

Let me see what I can come up with.

PEN
10-23-2009, 08:49 PM
>> MAXScript Rollout Handler Exception: -- Runtime error: No method found which matched argument list <<

That is the error when it is trying to call the .add method. Note that this is only some times. The function will work 20 times and then crap out, then work another 20.

denisT
10-23-2009, 09:26 PM
>> MAXScript Rollout Handler Exception: -- Runtime error: No method found which matched argument list <<

That is the error when it is trying to call the .add method. Note that this is only some times. The function will work 20 times and then crap out, then work another 20.

it's a memory overwrite issue... i'm 100% sure ... probably the function corrupts some chunk of memory.

biddle
10-23-2009, 10:59 PM
If it is memory corruption you might try sprinkling in calls to the .NET garbage collector to see if you can catch the problem.

dnGC = dotnetclass "GC"
gcForced = (dotnetclass "GCCollectionMode").Forced

then

dnGC.Collect dnGC.MaxGeneration gcForced

I've encountered problems setting properties of .NET objects that I declared as dotNetControls. Its never intermittent like you describe though, it either works, or it doesn't.

For example, trying to the set the ImageList property of a TreeView failed when the TV was hosted as a dotNetControl, but worked when I created it as a dotNetObject.

I'd see a message like "can't convert dotNetObject:System.Windows.Forms.ImageList to System.Windows.Forms.ImageList" --wierd!

PEN
10-24-2009, 12:26 AM
Well it sounds like the same sort of thing how ever. I will give your solution a try. I have been using dngc.collect but not the rest of what you have posted. I will have a look at what you have there. I think that you are right Dennis, sounds like if could be over writing and then getting confused along the way.

CGTalk Moderation
10-24-2009, 12:26 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.