diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-10-23 15:47:34 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-10-23 15:47:34 -0400 |
| commit | 0f8ccfaf496c3c761c06285574048f8866ef692c (patch) | |
| tree | d4100df4cd24facfe89a68e46a7a31f94be1d0ec /MediaBrowser.Common.Implementations | |
| parent | 07791d46a571d3d6eed23e98ec0fe1c46ea0d37f (diff) | |
prep for portable common
Diffstat (limited to 'MediaBrowser.Common.Implementations')
| -rw-r--r-- | MediaBrowser.Common.Implementations/BaseApplicationHost.cs | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index b1e6a04533..baf6d85af6 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -445,20 +445,28 @@ namespace MediaBrowser.Common.Implementations private IPlugin LoadPlugin(IPlugin plugin) { - var assemblyPlugin = plugin as IPluginAssembly; - - if (assemblyPlugin != null) + try { - var assembly = plugin.GetType().Assembly; - var assemblyName = assembly.GetName(); + var assemblyPlugin = plugin as IPluginAssembly; - var attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0]; - var assemblyId = new Guid(attribute.Value); + if (assemblyPlugin != null) + { + var assembly = plugin.GetType().Assembly; + var assemblyName = assembly.GetName(); - var assemblyFileName = assemblyName.Name + ".dll"; - var assemblyFilePath = Path.Combine(ApplicationPaths.PluginsPath, assemblyFileName); + var attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0]; + var assemblyId = new Guid(attribute.Value); - assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId); + var assemblyFileName = assemblyName.Name + ".dll"; + var assemblyFilePath = Path.Combine(ApplicationPaths.PluginsPath, assemblyFileName); + + assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId); + } + } + catch (Exception ex) + { + Logger.ErrorException("Error loading plugin {0}", ex, plugin.GetType().FullName); + return null; } return plugin; @@ -596,7 +604,7 @@ namespace MediaBrowser.Common.Implementations } catch (Exception ex) { - Logger.ErrorException("Error creating {0}", ex, type.Name); + Logger.ErrorException("Error creating {0}", ex, type.FullName); throw; } @@ -615,7 +623,7 @@ namespace MediaBrowser.Common.Implementations } catch (Exception ex) { - Logger.ErrorException("Error creating {0}", ex, type.Name); + Logger.ErrorException("Error creating {0}", ex, type.FullName); // Don't blow up in release mode return null; } |
