Strange crash with mixed dotNet and Max button


So I have a typical create dialog with a containerControl and a treeview in the container. I also have two Max Script buttons, one has an event handler that is just printing a local variable at the moment and has nothing to do with the treeview at all. How ever once I have pressed the button and I try and click on the treeview it locks up Max and crashes it. Not just the script but Max it self.

Any one ever seen anything like that? Still testing to see what I can find but it has been elusive so far.

Bug with setting a dialog to modal and dotNet button (Causes crash)

Found it, no wonder I had a hard time. I’m getting the createDialog to be modal and that is the cause of it. WTF!


rollout testR "Test"
	local someString=""
	button testBt "Test"
	dotNetControl cc "containerControl"
	fn initTv=
		tv=dotNetObject "treeView"
		cc.controls.add tv
	on testBt pressed do
		print someString
	on testR open do
createDialog testR width:400 height:400 modal:true


Yes, seems to be a very shy bug
I only could repro it the FIRST run. After that all subsequent runs do not repro the bug. Everything is working as expected and no deadlock occures.
So it’s propably some .NET initialization problem ?
I bet after a system reboot, i would again be able to repro


I can reproduce it every time. It also has nothing to do with treeview per se, you can replace it with ‘Button’ for example and still get the same result.
Just when you think you’ve seen every 3dsmax bug…


I don’t get any problems on 2013, works fine, either modal or not. :shrug:

EDIT: i see it now. my bad. What a crock of sh*t!


could you post a code that crashes your max for sure, please? i can’t reproduce the issue


That code crashes 2014 every time Denis.

  • Run Paul’s code
  • Press the MXS button
  • Press the container control


yes. i see it now. i use slightly modified dotnet plugin in max 2010… it doesn’t crash. max 2014 constantly crashes with your sample…
it’s bad. because it’s a very likely scenario. it would be interesting to find a solution.


I get the same behavior in 2009, so it’s not anything version specific…


i’ve localized the problem. the issue is related to stealing a focus from mxs control by .net control.
check the sample where i move the focus from “GOOD Button” to the Container and the window works.

try(destroydialog crashtest) catch()
 rollout crashtest "Crash Test" width:200 
 	button mxs_bt "GOOD Button" width:100
 	button bad_bt "BAD Button" width:100
 	dotNetControl cc "ContainerControl" height:24
 	fn init =
 		bt = dotnetobject "Button"
 		bt.Backcolor = bt.Backcolor.Transparent
 		bt.text = ".NET Button"
 		controlops.setselectable bt off
 		bt.Dock = bt.Dock.Fill
 		cc.controls.add bt
 	on mxs_bt pressed do
 		setfocus cc
 	on crashtest open do
 createDialog crashtest modal:on


another localization… the dotnetcontrol causes the problem. when i directly parent a dotnet form control to a mxs rollout everything works well.


Interesting. I will report it to ADSK.


i kinda know the answer…
“we are too busy because of making the new ORANGE interface, and there is no time for us to fix any bug that was made more than ten years ago. sorry, but we can not be responsible for every sh#t we wrote… thanks again. good luck and be happy! :)”


:). Wow…what ORANGE interface?:slight_smile:


You sir have a bad attitude… welcome to the club;)


I can’t reproduce it at all in 2011.
For what it is worth.

Sure enough, after posting this, I tried one more time. That one failed miserably.


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.