Graphics

 View Only
  • 1.  Error trying to access text in xpTextObject

    Posted 12-07-2022 16:44
    I just updated from Xpression 9 to 10.55  I get the error when I run the following code:
    _scene.GetObjectByName("xOffsetVal", out temp);
    _temp = (xpTextObject)temp;
    string offset = _temp.Text;

    System.AccessViolationException
    HResult=0x80004003
    Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    It happens on the last line of code.  Is there a new setting for text objects to allow this to work?


    ------------------------------
    David Ball
    ------------------------------


  • 2.  RE: Error trying to access text in xpTextObject

    Ross Staff
    Posted 12-13-2022 10:31
    Did you uninstall any XPression software from you PC at any point? 
    For example, did you install Designer and Studio and then uninstall Studio? 
    I would try re-installing XPression (whatever edition you have). You could also try deleting the script cache folder (close XPression before deleting):
    XPression > Edit > Preferences> On Disk Cache > Script Engine > Path


  • 3.  RE: Error trying to access text in xpTextObject

    Posted 12-13-2022 15:18
    Hello,
    I never uninstalled Xpression.  I have only ever had the developer version on my desktop.  I did try to re-install (10.55 I was using 9) and had the same result.  I cleared the script engine cache.
    I do find that if I do the following
    _scene.GetObjectByName("xOffsetVal", out temp);
    _temp = (xpTextObject)temp;
    _temp.Text = "a";
    string offset = _temp.Text;

    it doesn't crash but if I look in the debugger it shows the value of offset as null.  Also, it shows the value of _temp.Text as null.  The value in the text object in the xpf is 70.  The value never gets updated to "a"
    thanks
    dave


    ------------------------------
    David Ball
    ------------------------------



  • 4.  RE: Error trying to access text in xpTextObject

    Ross Staff
    Posted 12-14-2022 08:41
    Are you getting a scene copy or the actual scene? How are you storing _scene in your code? 

    Your collogues also reached out to us on a separate topic and I have recommended you you switch to the normal 10.5 or 11.0 branch and not use the 10.55 branch - that won't have anything to do with this issue, but there probably isn't a reason to be using 10.55.


  • 5.  RE: Error trying to access text in xpTextObject

    Posted 12-14-2022 14:44
    Hello,
    I get the scene from the project, which I get from the engine.  We have a few xpfs and the one with the issue isn't the first, however, it is the first that tries to access a text object during our initialization process.
    _engine = new xpEngine();
    for (int n = 0; n < _engine.ProjectCount; n++)
    {
    _engine.GetProject(n, out xp);
    xp.GetScene(m, out _scene, false);

    I get this error with 10.5 as you expected.  I will see if I can isolate the issue or get it to happen in another xpf.
    thanks for your help
    dave


    ------------------------------
    David Ball
    ------------------------------



  • 6.  RE: Error trying to access text in xpTextObject

    Ross Staff
    Posted 12-14-2022 16:28
    xp.GetScene(m, out _scene, false);

    This call is pulling the actual scene from the Project, so the VB garbage collector could be collecting that variable. Can you try switching the boolean to true and pulling a scene copy? 

    How are you storing the scene? 



  • 7.  RE: Error trying to access text in xpTextObject

    Posted 12-15-2022 18:39
    Hello,
    I have figured out the issue.  Since we need to be able to build this project on our build server and we don't have Xpression installed on the build server we have included a 3rd party folder in our source control and included the libraries xpression.net.dll and xptoolslibs.net.dll.  Adding the updated versions of these libraries resolved the issue.
    thanks for your help.

    ------------------------------
    David Ball
    ------------------------------



  • 8.  RE: Error trying to access text in xpTextObject

    Posted 12-16-2022 15:41
    Hello, 
    I do have another question.  when we add the reference to the library should we be adding Interop.XPression.dll (which I find by adding the com object reference in VS) or xpression.net.dll (which is in C:\Program Files\XPressionDeveloper\net) or does it matter?
    thanks
    dave

    ------------------------------
    David Ball
    ------------------------------