title: Strange exception opening new SSMS query window
body: <p>I see this exception each time I try to open a new SQL Server Management Studio Query window, or right click any user object to <strong>modify</strong>, <strong>view</strong> or <strong>generate script</strong>:</p>
  
  <blockquote>
    <p>Could not load file or assembly 'System.Threading.Tasks.Dataflow,
    Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
    one of its dependencies. The system cannot find the file specified.
    (Microsoft.VisualStudio.ExtensibilityHosting)</p>
  </blockquote>
  
  <p>I have uninstalled and re-installed SSME 2017.3 and even upgraded to SQL Server 2017 Developer Edition all in a bid to fix this error, none has worked.</p>
  
  <p>The exception details are as follows:</p>
  
  <pre><code>===================================
  
  Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. (Microsoft.VisualStudio.ExtensibilityHosting)
  
  ------------------------------
  Program Location:
  
     at Microsoft.VisualStudio.ExtensibilityHosting.VsExportProviderFactory.&lt;CreateAssemblyCatalogsAsync&gt;d__54.MoveNext()
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine&amp; stateMachine)
     at Microsoft.VisualStudio.ExtensibilityHosting.VsExportProviderFactory.CreateAssemblyCatalogsAsync(IReadOnlyCollection`1 assemblyPaths, IProgress`1 progress, CancellationToken cancellationToken)
     at Microsoft.VisualStudio.ExtensibilityHosting.VsExportProviderFactory.&lt;GetCurrentAssemblyCatalogsAsync&gt;d__31.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.VisualStudio.ExtensibilityHosting.VsExportProviderFactory.&lt;GetExportProviderFactoryAsync&gt;d__23.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.&lt;GetMEFV3ExportProviderInternalAsync&gt;d__49.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.&lt;GetMEFV3ExportProviderWrapperAsync&gt;d__48.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
     at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
     at Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run[T](Func`1 asyncMethod, JoinableTaskCreationOptions creationOptions)
     at Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run[T](Func`1 asyncMethod)
     at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetLazyValue[T](AsyncLazy`1 lazy)
     at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[T]()
     at Microsoft.VisualStudio.Editor.Implementation.EditorParts.get_ContentTypeRegistryService()
     at Microsoft.VisualStudio.Editor.Implementation.LanguageServiceToContentTypeMapper.MakeLanguageServiceContentTypes(SettingsStore settingsStore)
     at Microsoft.VisualStudio.Editor.Implementation.LanguageServiceToContentTypeMapper.InitLanguageServiceToContentTypeMapper(IServiceProvider serviceProvider)
     at Microsoft.VisualStudio.Editor.Implementation.TextDocData.SetSite(Object pUnkSite)
     at Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextBuffer.SetSite(Object serviceProvider)
     at Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextEditorControl.CreateAndInitTextBuffer(Object sp)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptEditorControl.Initialize(Object sp)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptAndResultsEditorControl.Initialize(Object sp)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.SqlScriptEditorControl.Initialize(Object sp, String moniker)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.SqlScriptEditorControl.CreateInstance(Object serviceProvider, Boolean withEncoding, String moniker)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.EditorFactorySql.CreateEditorInstance(IServiceProvider serviceProvider, Boolean storeActiveConnIfNeeded, String moniker)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.EditorFactoryBase.Microsoft.VisualStudio.Shell.Interop.IVsEditorFactory.CreateEditorInstance(UInt32 createFlags, String moniker, String physicalView, IVsHierarchy hierarchy, UInt32 itemId, IntPtr existingDocData, IntPtr&amp; docViewIntPtr, IntPtr&amp; docDataIntPtr, String&amp; caption, Guid&amp; cmdUIGuid, Int32&amp; result)
     at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, IVsProject projectToAddScriptTo, UIConnectionGroupInfo connectionInfoList, IDbConnection liveCon, String rootName)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, IVsExternalFilesManager extFileMgr, UIConnectionGroupInfo connectionInfoList, IDbConnection liveCon, String rootName)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, UIConnectionGroupInfo connectionInfoList, IDbConnection liveCon, String fileRoot)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, UIConnectionInfo ci, IDbConnection liveCon)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.OpenFileInEditor(String filePath, IManagedConnection connection)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.ScriptToQueryEditor(String text, IManagedConnection mc)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.ScriptExistingTextObjectToWindow(IManagedConnection mc)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.InvokeTextObject(IManagedConnection connection)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.Invoke()
  </code></pre>
  
  <p>Thanks.</p>