I have to piggyback off of this topic because I found this issue today and it's a pretty far reaching issue.
We've built some infrastructure to start bringing some simplicity to the madness that is everyday construction. This means, for example, a common internal NuGet package infrastructure that we can use to standardize stuff like logging, database calls, Stratus, etc.
It's really seemed like a boon so far.
I have a pretty beefy FabricationAPI addin that's primarily used in CAMduct for now, but will also be used in ESTmep. There's not much plan for any usage in CADmep though. The specific solution relative to this AddIn is x64 across all projects within it. Everything seems to run fine if you open the AddIn and smoke test it thoroughly.
However, if you close the MAJ file that you are in and open a new one, you will start hitting protected memory issues because the items in Job.Items become polluted with empty dimension references that have "" for a name and 0 for a value. And if you close and open the AddIn again, it just straight up crashes because the items are now protected memory or non-existent.
I'm checking and double checking, but if the conclusion to this is that I cannot use any external packages, which consist of a few small ones of our own and Microsoft's Logging/DI frameworks, then this reflects extremely poorly on the Fabrication API's readiness for production and realistic commercial use.
Although I feel like I originally assigned everything to x64 because I was hitting protected memory issues even in the first opened project, so I'm not entirely convinced that this is the cause. But it is problematic all the same. Anyone familiar with this?
Edit:
And for the sake of clarity, my test was pretty simple.
Land in a breakpoint somewhere in my AddIn startup and just use the intermediate window to watch this:
Job.Items.SelectMany(item => item.Dimensions).Select(dim => dim.Name)
The first project you open, that code gives you the expected list of dimensions like "Width", "Depth", "Length", etc. You should see no "" values.
Close the addin, close the current CAM project, then open another one. Repeat and you'll see values of "" all over the place.
You can also target the instances of it via
Job.items.Where(item => item.Dimensions.Any(dim => string.IsNullOrWhitespace(dim.Name))
Last Edit:
I just copied their HelloFabrication code and simply added a single call to
var emptyItems = Job.Items.Where(item => item.Dimensions.Any(dim => string.IsNullOrWhiteSpace(dim.Name)))
.ToArray();
Still crashes. I think I found a global bug. You can't use Job.Items reliably in CAMduct/ESTmep if you are not staying in the same MAJ file per session. And in CADmep I know people are already just using the AutoCAD toolset to get fab items.
I will file an ADN report, hope they still address FabAPI issues.