Issue
The powerVault cmdlet Show-Inspector fails with following error message when used within a PowerShell session where powerGate module got imported (e.g. within a BOM Window session):
Show-Inspector : Exception has been thrown by the target of an invocation
The powerVault logfile contains following Warning entries:
2018-08-30 15:40:50,067 [16] WARN powerVault.Cmdlets.Cmdlets.Debug.Window.VariableGrid - VariableGrid.InitializeComponent() | Failed, exception = {System.Windows.Markup.XamlParseException}.
System.Windows.Markup.XamlParseException: Die Datei oder Assembly "System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden. ---> System.IO.FileNotFoundException: Die Datei oder Assembly "System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
bei System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
bei System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
bei System.Reflection.Assembly.Load(AssemblyName assemblyRef)
bei System.Windows.Baml2006.Baml2006SchemaContext.ResolveAssembly(BamlAssembly bamlAssembly)
bei System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlTypeToType(BamlType bamlType)
bei System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
bei System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16 typeId)
bei System.Windows.Baml2006.Baml2006SchemaContext.GetProperty(Int16 propertyId, XamlType parentType)
bei System.Windows.Baml2006.Baml2006Reader.Process_PropertyArrayStart()
bei System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
bei System.Windows.Baml2006.Baml2006Reader.Process_BamlRecords()
bei System.Windows.Baml2006.Baml2006Reader.Read()
bei System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
bei System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
Following version of powerVault is used: v19.0.9 or earlier
Cause
The powerVault Variable Inspector requires it's own version of the assembly System.Windows.Interactivity. With the features in powerGate v19.0.7, powerGate delivers it's own version of this assembly in the GAC.
Since the Inspector Window is not able to work with this shared assembly, the cmdlet fails and logs following exception:
Could not load file or assembly 'System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
Solution
Before calling the Show-Inspector cmdlet the required version of the System.Windows.Interactivity.dll assembly can be loaded into the "LoadFrom" context by calling following function once:
[reflection.Assembly]::LoadFrom('C:\Program Files\coolOrange\Modules\powerVault\System.Windows.Interactivity.dll')