LoadProfile after plugin update

I have overridden LoadProfile and SaveProfile in my CRhinoUtilityPlugIn implementation. These work as expected. However, there is an issue after installing an update to the plugin using an RHI file. When the new updated plugin is loaded for the first time, Rhino calls my LoadProfile function, but all of my calls to CRhinoProfileContext::LoadProfile* return false. I’m wondering if there is something special I have to do to manage these profile settings in the case of a update. Thanks!

Hi @mike14,

A plug-in’s persistent data is stored here:

%APPDATA\McNeel\Rhinoceros\7.0\Plug-ins\[Name (GUID)]\settings

The data is saved in an XML file.

So as long as the plug-in name and the plug-in GUID have not changed, you should be able to read your persistent data.

– Dale

Thanks for your reply.

I see the XML that is produced and it operates appropriately. My plugin’s name and GUID remain the same.

The issue I am seeing is after I update the plugin. When Rhino 7 opens after the update, it’s shows the dialog indicating “preparing plugin for first use.” Rhino then calls the plugin’s LoadProfile function and the LoadProfileInt function returns false. Closing Rhino then calls the plugin’s SaveProfile function, which saves the defaults and it operates appropriately again. It only fails on the plugin’s first load. As a note, the given CRhinoProfileContext object in Load/SaveProfile always returns a ProfileContextLocation() of cl_scheme_current_user.

I have created a new plugin that exhibits the problem in a more simple environment. It’s a bit cumbersome to reproduce since it requires two RHI files, but here’s the procedure:

  • Install the plugin using an RHI file (install for all users)
  • Open Rhino 7 and change the setting using the “SetSetting” command
  • Close and reopen Rhino to confirm the setting is saved by running the “SetSetting” command again (also can verify the XML file)
  • Install a newer version of the plugin from an RHI file (install for all users)
  • Open Rhino 7 and check the loaded settings by running “SetSetting”

This plugin also outputs Load/SaveProfile log info to “C:\temp\testing.log”.

I’m not sure if this is the right place to report this, but I have attached my plugin’s code along with the two RHI files I used.

SettingsOnUpdateTest.2.rhi (54.6 KB)
SettingsOnUpdateTest.rhi (54.6 KB)
SettingsOnUpdateTest.zip (36.0 KB)

Hi @mike14,

I believe this is a Rhino Install (rhi) issue.

Try this:

  1. Unzip version 1 of your plug-in
  2. Launch Rhino and drag the plug-in on top of it
  3. Run your test command
  4. Close Rhino
  5. Unzip version 2 of your plug-in and overwrite version 1 with it
  6. Launch Rhino and run your test command

Does this work?

– Dale

Yes. That procedure works fine. The newer version of the plugin loads the settings correctly.

This from the developer documentation:

– Dale

it is a bit grating when you try to do things “the right way”, so use official rhino methods e.g. here for installation, get everything tested and working, only to have the technology abruptly deprecated half a year after the release of v7, with the replacement being green, and not supported in v6

Hi @jdhill,

Yep. But I also don’t know all the issues behind this decision.

– Dale

Thanks Dale. Looks like I’ll be switching to Yak.

@jdhill It is frustrating. But sometimes things gotta’ change if they’re gonna’ get better. Also, it looks like Rhino 6 is kinda supported.

yes, kind of – but packagemanager is a test command in v6, and I am not going to tell my users to run test commands