problems compiling error CallbackOnCollectedDelegate was Detected

Jun 12, 2011 at 8:36 PM

hi i am very interested in this project :)

at this time I try to compile the examples but I get an error that I can not continue


A callback was made on a garbage collected delegate of type 'Mommosoft.ExpertSystem!Mommosoft.ExpertSystem.Interop.QueryDelegate::Invoke'.
This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.

I have tried to repair the error after I read this article:
but i think I have no permissions to modify the dll file

please help! thanks!
Jun 12, 2011 at 8:43 PM

forget mention the line that will not let me go (paint it in wine color):


private void OnClickButton(object sender, EventArgs e) {
            Button button = sender as Button;
            // Get the state-list.
            String evalStr = "(find-all-facts ((?f state-list)) TRUE)";
            using (FactAddressValue f = (FactAddressValue)((MultifieldValue)_theEnv.Eval(evalStr))[0]) {

i think problem is with FactAddressValue class

also i dont know if this problem is fixed, there are problems elsewhere.

Jun 14, 2011 at 9:02 AM
Edited Jun 14, 2011 at 9:42 AM


I am glad you like the project. Problem with delegate is clear. I will fix it.  

I am not so clear what you mean by  "i think problem is with FactAddressValue class"?  That problem with delegate is connected with FactAdressValue or something else, please clarify. 

Jun 14, 2011 at 1:18 PM

Hi ztban,

Problem with callback disposing is fixed. Hope you can proceed with your code.