automations and the application domain

xoxo Member Posts: 34
I'm having a slight problem with a .Net COM interop automation. In one of the .Net classes there is a static variable and it appears that even though the codeunit that references the automation is calling clearall as the last action, upon the next invocation of the codeunit the .Net application domain is the same -- at least the static variable has accumulated more state so it doesn't start from a clean slate. I'm not too happy about this persistent application domain. Any hints?

Comments

  • jlandeenjlandeen Member Posts: 524
    Have you looked into how the garbage collection works in .Net. I'm not super .Net savvy, but from my understanding when an object goes out of scope it's free for the garbage collector to dispose of, but there is no guarantee on when those values are flushed.

    Could you add a function to reset or clear your objects state.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • kinekine Member Posts: 12,562
    Have you tried to use the second parameter of the Create function? (NewServer parameter)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • xoxo Member Posts: 34
    I don't think it's the GC - it would be remarkable if it were so slow to flush the objects - besides, I'm expecting the entire application domain to perish and therefore the static state of my class to perish as well.

    I think kine has a point - I need to look at the create function. :-)
  • pdjpdj Member Posts: 643
    I have the same problem I think. .NET garbage collection doesn't seem to work from NAV. :(
    We have made a component for socket communication, which also kept living no matter how many times we tried to clear it. Once wrapped in C++ it worked like a charm...
    Regards
    Peter
Sign In or Register to comment.