There has been a change in the way category visibility works in between 2012 and 2013. I believe it has to do with the discipline filter list from the Visibility/Graphic dialog. How do I test for, exclude or override categories hidden by the user in this way? The VisibilityControl sample from the SDK samples illustrates the error. Thanks.
Can you please provide the steps that I can use to reproduce the error with the SDK sample. I tested it and I found an unexpected behavior with the PickObject() but the rest of the sample seemed to work fine.
I simply build it, load and run it from the Add-In Manager. When I select a category in the chekedListBox, I get the attach error. Click OK, and the category (levels in this case) remain visible. The second image is from the Add-In I wrote. I get the error in a Drafting View that is named 'Save With This View'. It is displaying the view name as a category. I can't find anything about that view Revit Lookup/Snoop DB... That would indicate why it would be considered 'user hidden'. The errors aren't necessarily the same, but I thought I would be able to solve mine from an answer to the SDK sample. They both worked fine in 2012. I'm assuming it has something to do with the Discipline filter in the V/G dialog. Thanks.
Sorry for the delay in responding back to this query. The SDK sample works perfectly well at my end with Revit 2013 and with the Basic Sample Project that is included in Revit installation. Is the error you are receiving specific to a Revit file? If yes, can you please inlcude that to this post so that I can investigate this further. Please make sure the revit file does not contain any confidential information.
Else, I could take a look at your Sample VS project if you can create a minimal buildable version of it and include it here.
I did some search but so far could not get any specific reports of similar dialogs in Revit 2013.
I realize this thread is kind of old, but I have encountered the same problem and spend hours on it. It is worsened by the unclear exception message. So I guess it would be helpful to add a solution here just in case someone else will see this when they google.
Basically, not all categories' visibility can be accessed via someCategroy.get_Visible(someView). It needs to be checked first via someCategory.get_AllowsVisibilityControl(someView) is true.
Access a broad range of knowledge to help get the most out of your products and services.