This is a C# standalone application targeting .NET 4.0 Client Framework. This used to work before with SolidWorks 2017 sp1. Currently we've upgraded to Solidworks 2017 sp2.
I get AccessViolationException specifically when I add or set custom properties using the add methods or .Set2. Getting custom property values works fine.
If it helps, this is what it does before the exception:
1. swApp.copyDocument()
2. open assembly of copied document from step 1
3. swApp.CloseDoc() original document from step 1
3. open first part of step 2
4. swPart.Extension.CustomPropertyManager[""]
5. manager.set() <- ViolationException
I also have some c# forms before running the following above. I doubt they would cause issues.
SolidworksApi macros