Missing method on some machines but not others

Missing method on some machines but not others

Anonymous
Not applicable
1,972 Views
14 Replies
Message 1 of 15

Missing method on some machines but not others

Anonymous
Not applicable

So I've got my first addin (and C# project) built and it works pretty well for some users, but not for others.

 

The attached image shows the error that some users are getting. The error was in Revit 2015, and the addin was built with the RevitAPI.dll and RevitAPIUI.dll from that version. Set to copy local false on both.

 

Every machine that this was tested on was checked for all Autodesk updates. The .NET framework was up to date on these machines as well.

 

So it seems to me that, for whatever reason, the AddIn is having difficulty finding the "ShowTitle" bool method that I used on schedule placement.

 

Both computers that this didn't work on had Revit 2014, 2015, and 2016. Most of them do not have 2014, but there was one machine I tested where the addin worked and 2014 was installed.

 

At a loss here about what's wrong. Any help would be greatly appreciated.

0 Likes
Accepted solutions (2)
1,973 Views
14 Replies
Replies (14)
Message 2 of 15

Anonymous
Not applicable
Have you checked what other addins are installed on the machines? Check both the user specific AppData location and the all users ProgramData paths. There could be another addin that is loading an old version of a dll.
0 Likes
Message 3 of 15

Anonymous
Not applicable

Bit of a hodge podge on that one. I think you're right.

 

But some of these AddIns come in executables and install themselves in bizarre ways. We have one that installed itself in the user documents under the 2013 folder, but it's active for Revit 2015 as well. The 2015 folder was empty though. Made my head hurt figuring that thing out.

 

I tried logging in as a separate Windows user, then clearing out the ProgramData AddIn installs other than my own, temporaritly. But ended up with the same result even from there.

 

Plus, we have one user that is using this troublesome AddIn and yet my AddIn works alongside it, so maybe I'm focusing on the wrong one.

 

I appreciate your time Scott, I understand that with the amount of variables this introduces, it'd be difficult to help from here. But any if you think of anything else that might help pinpoint this, please let me know. Appreciated either way.

0 Likes
Message 4 of 15

Anonymous
Not applicable
What class/ dll is the "ShowTitle" method located in? You could check the vetsion of this dll on the good machines against the bad ones to see if that might be your problem. If the dll files match then maybe use reflection to display the version of the dll in your catch block to confirm whether a different version is being loaded by Revit or another addin.
0 Likes
Message 5 of 15

Anonymous
Not applicable
Another thing to consider is that the .addin files are loaded by Revit in alphabetical order. If you prefix the name of your .addin file with something like an underscore, number or some other character that usually appears first in file listings than it will be loaded before the other addins and therefore has more chance of loading the dlls it expects. I think from memory that the current user appdata addins are loaded before the all users programdata so keep that in mind.
0 Likes
Message 6 of 15

conoves
Autodesk
Autodesk
Accepted solution

Hello - 

 

ScheduleDefinition.ShowTitle was added in the 2015 Subscription Update release.  You can see this looking at the "Since:" entry in the RevitAPI.chm entry for this property.  So this method will not be available in 2015 versions that are not the Subscription update.  

 

If you wish to ensure that this error is not raised, there are two options:

 

1.    Don't install the add-in that depends on the subscription update API unless the Revit version is the 2015 Subscription update or an update of that version.   The RevitAddinUtility library which can be used to make installers has a property to check: RevitProduct.IsSubscriptionUpdate. 

 

2.   If the majority of the add-in can still work without setting this particular property, you can use .NET reflection to check if the method exists, and use the Invoke method on the Property or Method class (I can't remember the details for a settable property) instead of calling it directly in compiled code.   This makes the add-in code more complicated, but it allows the add-in to decide at runtime whether or not to try to invoke this property if it exists, and to avoid any compatibility issues if the property does not exist.

 

Thank you,

Scott Conover

 



Scott Conover

Senior Engineering Manager, Revit

Message 7 of 15

jeremytammik
Autodesk
Autodesk

In addition to Scott's explanation:

 

This method was added to the standard Revit API in Revit 2016, cf. the What's New documentation:

 

http://thebuildingcoder.typepad.com/blog/2015/04/whats-new-in-the-revit-2016-api.html#5.11

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 8 of 15

Anonymous
Not applicable
What was the point of the subscription updates anyway? Why not just put it all into the main stream? Im my experience most users didn't even know that the subscription only updates existed.
0 Likes
Message 9 of 15

conoves
Autodesk
Autodesk

Subscription updates allow us to get new functionality to customers more quickly and more frequently, instead of waiting for the next main release.   

 

You are correct that some users may not opt to take the updates or even be aware of them.  We hope to make it easier on both fronts with the Autodesk Desktop Application management tool.  And we hope to continue to put in new features in updates so users will want to update.  Revit 2015 was the first version of Revit with such updates.

 



Scott Conover

Senior Engineering Manager, Revit

0 Likes
Message 10 of 15

stever66
Advisor
Advisor

Did this get resolved?

 

If not try this:  Find the dll file on the problem machines, right click and select properties.  See if something states "This file was copied from another machine, and may be blocked."   If so, there should be a button next to it that says "Unblock".

 

I just spent a large part of the day learning that one.

 

 

0 Likes
Message 11 of 15

Anonymous
Not applicable
Unfortunately, not yet. I think the advice is good, but I have to work this project between other more run-of-the-mill work. Which has been busy. Plus, the users that I'm making this for are very busy and rarely can allow me to use their machines. I had some difficulty implementing the IsSubscriptionUpdate method unless it was from ApplicationServices, which appears to also be a newer method since it caused the same error as ShowTitle. Pulling it from RevitProduct wasn't working in a way that I'm familiar with in C#. I should probably be able to either update the status or tag one of these responses as the solution tomorrow though.
0 Likes
Message 12 of 15

Anonymous
Not applicable

Alright, I got my head on straight and used the SubscriptionUpdate() from RevitAddinUtility.

 

I got the attached familiar error dialogue on one of the problem machines, while it works on those without these issues.

 

for posterity, here's how I checked.

 

List<RevitProduct> Revits = RevitProductUtility.GetAllInstalledRevitProducts();
            foreach (RevitProduct tR in Revits)
            {
                if ((tR.Version == RevitVersion.Revit2015) && (tR.IsSubscriptionUpdate.Equals(false)))
                {
                    revitSub = false;
                }

            }

I used the public revitSub variable to check against, and if it's false, skipped the ShowTitle step.

 

But that's not working.

0 Likes
Message 13 of 15

Anonymous
Not applicable

I don't mean to respond to myself so much, can't edit. I've taken out any checks for subscription and removed the Title function from the AddIn entirely.

That allowed it to work.

 

I compared the RevitAPI.dll files that I'm using, and the one that their machines are calling up, and the difference in versions are over a year. Despite the suites being updated on the machines tested. This tells me that the solution had to do with the products themselves in some fashion, like the subscription. I appreciate everyone's help on this. It kept a huge project from going to waste.

0 Likes
Message 14 of 15

Anonymous
Not applicable
Accepted solution
For the use of others: If you run into this issue with subscription discrepancy, the best choice I found was to set a template to have a view template for the schedule as desired. Then sift through the view templates for the one you've set up, then apply it to the schedule that you generate.
0 Likes
Message 15 of 15

Anonymous
Not applicable

nevermind, accidental nonsense post. nothing to see here... Man Embarassed

0 Likes