Uninstalling extension shows 'mark_as_uninstalled' message

I’ve just noticed something peculiar yesterday when uninstalling my own extension. I happened to have the Ruby Console open and the following message popped up:

Extension returned wrong type for method mark_as_uninstalled

I’ve checked the docs and couldn’t find anything. Any ideas on how to suppress that message?

(1) Did you override the mark_as_uninstalled() method in your extension instance ?
It is an internal housekeeping method that should never be called directly by extensions nor overridden.

BTW, The method always should return true as its single statement is:

@has_been_uninstalled = true

(2) What is the your value of $VERBOSE ? If set to true you will get many more warnings in the console.
The default value is false I believe. Extensions should only ever change this global var’s value temporarily.
Setting to nil will suppress all warnings.

But be warned, (pun intended,) some of the internal API warnings have no way to switch them off.


The "extensions.rb" file is located in %ProgramFiles%/SketchUp/SketchUp 2022/Tools can be opened manually and read. Do not change it as all the contents of the "Tools" subfolder have been signed as is.

Nope.

That’s also set to false.

I’ve seen this message when uninstalling other extensions as well. Not sure what I have to do to prevent that line from showing up.

I confirm I see it in latest version of 2023.

You cannot prevent it. The decision to output it to IO is made in the SketchUp core.
And, as you say, it occurs for all extensions, so suppressing it for one and not all would do no real good.

I tested and the warning appears regardless of the value of $VERBOSE.
(Normally setting to nil suppresses all such warnings.)

A user will only see it if they happen to have the Console open whilst managing their extensions. Most will not.

1 Like

I see the same on both Windows and macOS. It was an unsigned extension.

1 Like

Update on this. After some testing I determined that the Extension Manager core expects a NULL result from the mark_as_uninstalled() callback. So in a subclass override for the callback, if the last line is return nil, the core is happy and does not spit out the frivolous type error message.

See:

Perform operations in a plugin when its is being uninstalled - #7 by DanRathbun

For all extensions the "Tools/extensions.rb" would need to be updated by Trimble (or the EM core.)


Developers (who are not subclassing SketchupExtension,) could modify their SketchupExtension objects individually by defining a singleton method override in the registrar file to prevent the frivolous message in older SketchUp versions.

This will only work for extensions with such an override:

    # After creating the SketchupExtension object referenced as EXTENSION:
    EXTENSION.define_singleton_method(:mark_as_uninstalled) { super; nil }
1 Like