Cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve file properties

Pioneer
Pioneer

Hi, I have this code that is working well in ST7 and I am trying to run it in 2019.

SolidEdgeFileProperties.PropertySets propertySets = new SolidEdgeFileProperties.PropertySets();
SolidEdgeFileProperties.Properties properties = null;
propertySets.Open(threeDFilepath);
properties = (SolidEdgeFileProperties.Properties)propertySets[0];
var descriptionProperty = (SolidEdgeFileProperties.Property)properties.get_PropertyByID(2);
var description = descriptionProperty.Value.ToString();
propertySets.Close();

I'm getting a AccessViolationException at propertySets.Open(threeDFilepath); and also if I inspect propertySets before the crash

image.png

I tried addind a reference to Solid Edge File Properties Object Library but it conflicts with the basic SolidEdge one.

11 REPLIES 11
Highlighted

Re: Retrieve file properties

Gears Phenom Gears Phenom
Gears Phenom

This may be due to the 32bit Libraries no longer being supported.   There are many threads on this topic in the forums.

 

Need to recompile with 64bit Typ Libs. 

Matt Johnson
Solid Edge Certified Professional
Solid Edge 2019 (SEEC) - Production
NX12 (Tc Integration)
Teamcenter 10.1.7

Re: Retrieve file properties

Pioneer
Pioneer

Thanks, I am already building in 64 bits. The integration works in most parts, I am abble to open, modify and save files in Solid Edge from my app. I include those libraries:

image.png

I choosed the 64 bits version in the case they are disponible. Those came from soa_client.zip in my Solid Edge installation media.

Maybe I'm just missing one, How can I tell the requirements for the fonctionality I need.

Re: Retrieve file properties

Phenom
Phenom

I could be way off  here, but I'll throw it out as I've been in the same place with exceptions and willing to chase down any lead.

  Is there a chance this is just file sharing issue?  I had a heck of a time opening files, even with read only access.  Pay close attention to thumbnail and properties preview features in MS File Explorer.  I don't remember details but there are times if a file is selected in File Explorer and properties or preview was turned on I could not open the file.

 

You didn't say much about how the root sypmtoms started other than ST7 -> 2019 upgrade.  Looks like you're debugging and get this far.  Was the exception thrown consistant or intermittant?  


->If you cannot find a Solid Edge setting, confirm you have a file open of the type that will be affected.
->If you have started a thread and a response solves the problem or answers the question you asked, then please mark it as solution. Note, there can be multiple solutions for a thread.

Re: Retrieve file properties

Pioneer
Pioneer

The problem is consistant for the cases I tried.
I am gonna try and verify the properties in file explorer for the files that fails, maybe I'll find something.

Re: Retrieve file properties

Phenom
Phenom

Is that file already opened by SolidEdgeApplication earlier in your program?  I remember now noticing that Windows File Explorer "Details Pane" would not show the correct metadata if the file is open in SE.  Once the file is closed and File Explorer refreshed the Details Pane would show correct information.  This combined with the exception thrown made me wonder if this may be what's going on.  

 

If I'm wrong, I apologize for the goose chase.


->If you cannot find a Solid Edge setting, confirm you have a file open of the type that will be affected.
->If you have started a thread and a response solves the problem or answers the question you asked, then please mark it as solution. Note, there can be multiple solutions for a thread.

Re: Retrieve file properties

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

@dosti,

 

can you verify the tips/solution given in this previous post:

 

https://community.plm.automation.siemens.com/t5/Solid-Edge-Developer-Forum/Accessviolationexeption-w...

 

 

Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: Retrieve file properties

Pioneer
Pioneer

@wku 

Here is my app.config, seems fine

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
  </startup>
</configuration>

The application have the STAThread Attribute. I searched for code creating threads or tasks and I found the creation for a distinct appdomain, I changed this to use a manualy created thread so I can set the ApartementState to STA and it does exactly the same thing

 

@bnemec 

The file is not open in Solid Edge and explorer detail pane shows the correct informations.

Re: Retrieve file properties

Pioneer
Pioneer

An other point that could be important:

I have a try catch around the failling code but it doesn't catch

Re: Retrieve file properties

Pioneer
Pioneer

I tried making the simplest app possible to test and I get the same error

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            SolidEdgeFileProperties.PropertySets propertySets = new SolidEdgeFileProperties.PropertySets();
            SolidEdgeFileProperties.Properties properties = null;
            propertySets.Open("path to an assembly");
            properties = (SolidEdgeFileProperties.Properties)propertySets[0];            
            var descriptionProperty = (SolidEdgeFileProperties.Property)properties.get_PropertyByID(2);
            var description = descriptionProperty.Value.ToString();
            propertySets.Close();
        }
    }
}