Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninstalled add-ins aren't properly removed #1192

Open
cameronwhite opened this issue Dec 28, 2024 · 2 comments
Open

Uninstalled add-ins aren't properly removed #1192

cameronwhite opened this issue Dec 28, 2024 · 2 comments
Labels
Milestone

Comments

@cameronwhite
Copy link
Member

After an add-in is uninstalled, e.g. the Night Vision add-in, on the next launch the add-in is still registered even though some files are missing:

Pinta: Failed to initialize add-in
System.IO.FileNotFoundException: Could not load file or assembly 'NightVisionAddin, Version=1.3.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

File name: 'NightVisionAddin, Version=1.3.1.0, Culture=neutral, PublicKeyToken=null'
 ---> System.IO.FileNotFoundException: Could not load file or assembly '/Users/cameron/Library/Application Support/Pinta/addins/addins/NightVisionEffect.1.3.2/NightVisionAddin.dll'. The system cannot find the file specified.

File name: '/Users/cameron/Library/Application Support/Pinta/addins/addins/NightVisionEffect.1.3.2/NightVisionAddin.dll'
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Mono.Addins.AddinEngine.CurrentDomainAssemblyResolve(Object sender, ResolveEventArgs args) in /Users/cameron/code/mono-addins/Mono.Addins/Mono.Addins/AddinEngine.cs:line 324
   at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
   at System.Reflection.TypeNameParser.ResolveAssembly(String assemblyName)
   at System.Reflection.TypeNameParser.GetType(String typeName, ReadOnlySpan`1 nestedTypeNames, String assemblyNameIfAny)
   at System.Reflection.TypeNameParser.Parse()
   at System.Reflection.TypeNameParser.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Assembly requestingAssembly, Boolean throwOnError, Boolean ignoreCase, Boolean extensibleParser)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at Mono.Addins.RuntimeAddin.GetType(String typeName, Boolean throwIfNotFound) in /Users/cameron/code/mono-addins/Mono.Addins/Mono.Addins/RuntimeAddin.cs:line 338
   at Mono.Addins.TypeExtensionNode.get_Type() in /Users/cameron/code/mono-addins/Mono.Addins/Mono.Addins/TypeExtensionNode.cs:line 104
   at Mono.Addins.TypeExtensionNode.CreateInstance() in /Users/cameron/code/mono-addins/Mono.Addins/Mono.Addins/TypeExtensionNode.cs:line 93
   at Mono.Addins.InstanceExtensionNode.GetInstance() in /Users/cameron/code/mono-addins/Mono.Addins/Mono.Addins/InstanceExtensionNode.cs:line 76
   at Mono.Addins.ExtensionNodeEventArgs.get_ExtensionObject() in /Users/cameron/code/mono-addins/Mono.Addins/Mono.Addins/ExtensionContext.cs:line 1331
   at Pinta.MainWindow.OnExtensionChanged(Object s, ExtensionNodeEventArgs args) in /Users/cameron/code/Pinta/Pinta/MainWindow.cs:line 273
@cameronwhite
Copy link
Member Author

From my investigation there are a couple issues here:

  • The satellite assemblies from translations are automatically packaged by mautil but aren't listed as file dependencies of the add-in. The uninstall action leaves these files behind, which causes it to fail to remove the add-in directory. The add-in file scanning then thinks an add-in is present since the folders still exist
  • The add-in removal also doesn't go through the normal process if the assemblies are loaded - in this case the add-in files are flagged for removal on the next run. This code path only removes the files and doesn't clear out the add-in folder, also causing the same issue with the add-in not being removed properly. This is somewhat related to RunPendingUninstalls not cleaning up empty directories mono/mono-addins#56

@cameronwhite
Copy link
Member Author

The first issue should be fixable by explicitly listing the satellite assemblies in the add-in manifest, but the second issue may require forking Mono.Addins, since the upstream repository now seems to be archived / read-only ...

@cameronwhite cameronwhite added this to the 2.2 milestone Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant