6
$\begingroup$

Bug introduced in V10.1 or earlier and persisting through V11.3

[CASE:3362265]


This evaluates fine for me:

CDFDeploy["test.cdf"
, DynamicModule[{}, Dynamic["Hello World"], Deinitialization :> 1]
]

But this results in a never ending evaluation that can not be aborted and requires you to quit Mathematica (not just the kernel)

CDFDeploy["test.cdf"
, DynamicModule[{}, Dynamic[{"Hello World"}], Deinitialization :> 1]
]

In practice any non trivial DynamicModule with Deinitialization can not be deployed as CDF...

Can you reproduce this? What can we do about this?

I have tried this in Mathematica 10.1 and 10.2 for Windows.

$\endgroup$
  • 3
    $\begingroup$ I am on MMA 10.2 (Win7). I can confirm that the first expression works fine, while the second one runs forever. The kernel reports "INTERNAL SELF-TEST ERROR: Kernels|c|6973" in the message window upon execution. This has to do with the Deinitialization option though, and not with the curly braces: without Deinitialization, either form works fine, with or without the braces. In the aftermath, quitting the kernel seems sufficient to recover on my system; the front end seems unaffected thereafter. This sure looks like a bug. $\endgroup$ – MarcoB Jul 29 '15 at 21:13
  • $\begingroup$ Update from WRI: "[...] The developer will try to fix the issue but there's no timeframe on when it'll be resolved unfortunately. [...]" $\endgroup$ – Kuba Jun 7 '18 at 10:38
2
$\begingroup$

Since it is already 3 years and counting it would be nice to have a workaround.

Don't have a perfect one but you can Export as .cdf which will be fine as long as you don't need CDFDeploy's options: "Target"/Deployed which are not respected by Export[..., "CDF", ...]:

Export[
  "test.cdf"
, DynamicModule[{}, Dynamic[{"Hello World"}], Deinitialization :> 1]
, "CDF"
]

Another workaround is to use wrap your DynamicModule with a notebook with:

NotebookEventActions :> {"WindowClose" :> deinitialization}

The downside is it will not have access to DynamicModule's variables (or it will require case specific tweaks). Additionaly "WindowClose" probably is not as general as Deinitialization. But I didn't test this method too much.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.