Today after installing extensions (e.g. Power tools) to my Visual Studio 2010 I have encountered this error while launching it ( specifically when I start editing a file from solution )
---------------------------
Microsoft Visual Studio
---------------------------
Visual Studio has encountered an exception. This may be caused by an extension.
You can get more information by running the application together with the /log parameter on the command line, and then examining the file 'C:\Users\MYUSERNAME\AppData\Roaming\Microsoft\VisualStudio\10.0\ActivityLog.xml'.
---------------------------
OK
---------------------------
I have tried uninstalling all of the extesnions but I still get the same error.
So I launched VS with /log and then I have these 2 errors in the log
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{CF9928D9-65AE-4319-A446-94ED5C45ECDE}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease) at Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents.OnReplace(ChangeInput[] pCI) at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChangedHighPriority(Object sender, TextContentChangedEventArgs e) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler 1 eventHandlers, TArgs args)
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{96FC7D44-BCDD-4F00-AE4D-07E26B2C0E52}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease) at Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private.OnChangeStreamText(Int32 iPos, Int32 iOldLen, Int32 iNewLen, Int32 fLast) at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChanged(Object sender, TextContentChangedEventArgs e) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler 1 eventHandlers, TArgs args)
Anyone knows what is this ?
It could be the problem described here (including a registry fix):
visual Studio crashes constantly
Related
I'm getting the following error when using Visual Studio.
For an unknown reason and at unpredictable times, the error starts showing up when I type into text boxes/fields in Visual Studio.
I can click items/objects, but I'm unable to use the keyboard to type into text boxes.
I primarily use Visual Studio for SQL development (SSIS, SSRS). We also use Team Foundation Server.
The only way I've found to fix the issue is to close and reopen Visual Studio. However, after a little while, the error returns. Unsure what causes the error to start happening.
See below for details:
Visual Studio Version
Microsoft Visual Studio Professional 2017
Version 15.9.15
Installed Version: Professional
Error Details:
Object reference not set to an instance of an object. (Microsoft Visual Studio)
------------------------------
Program Location:
at System.Windows.Input.TextServicesContext.Keystroke(Int32 wParam, Int32 lParam, KeyOp op)
at System.Windows.Input.TextServicesManager.TextServicesKeystroke(TextServicesContext context, KeyEventArgs keyArgs, Boolean test)
at System.Windows.Input.TextServicesManager.PreProcessInput(Object sender, PreProcessInputEventArgs e)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
I had a clean installation of Visual Studio 2017 and ReSharper but decided to upgrade both to 15.6.2 for Visual Studio and 2017.3.3 for ReSharper. Unfortunately now I keep on having a crash on Visual Studio with pop-up saying: visual studio an exception has been encountered. this may be caused by an extension.
So I disabled ReSharper but it keeps on going, and the error logs look like:
<entry>
<record>1912</record>
<time>2018/03/19 17:15:01.680</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.CodeAnalysis.Classification.AbstractClassificationService.<AddSyntacticClassificationsAsync>d__3.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Editor.Implementation.Classification.SyntacticClassificationTaggerProvider.TagComputer.AddClassifiedSpansForCurrentTree[TClassificationService](IClassificationDelegationService`1 delegationService, TClassificationService classificationService, SnapshotSpan span, Document document, List`1 classifiedSpans)
at Microsoft.CodeAnalysis.Editor.Implementation.Classification.SyntacticClassificationTaggerProvider.TagComputer.AddClassifiedSpans[TClassificationService](IClassificationDelegationService`1 delegationService, TClassificationService classificationService, SnapshotSpan span, List`1 classifiedSpans)
at Microsoft.CodeAnalysis.Editor.Implementation.Classification.SyntacticClassificationTaggerProvider.TagComputer.GetTags[TClassificationService](NormalizedSnapshotSpanCollection spans, HostLanguageServices languageServices, IClassificationDelegationService`1 delegationService)
at Microsoft.CodeAnalysis.Editor.Implementation.Classification.SyntacticClassificationTaggerProvider.TagComputer.GetTags(NormalizedSnapshotSpanCollection spans)
at Microsoft.CodeAnalysis.Editor.Implementation.Classification.SyntacticClassificationTaggerProvider.Tagger.GetTags(NormalizedSnapshotSpanCollection spans)
at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__39.MoveNext()
---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.CodeAnalysis.Classification.AbstractClassificationService.<AddSyntacticClassificationsAsync>d__3.MoveNext()<---
</description>
</entry>
Has anyone encountered such a behavior from Visual Studio 2017 and how did you solve it?
Info: bug still occurs in 15.6.3
Unfortunately I was kind of desperate on time - and patience - so I made a full repair on Visual Studio which seems to make it work fine. And then I had to reinstall ReSharper.
Sorry would have appreciated to spend more time to find a proper solution...
After having a problem with my installation of Visual Studio 2017 Microsoft recommended me to run InstallCleanup.exe -full this command removed Visual Studio 2017 and the Visual Studio installer from my computer but in the process broke something.
Now when I try to install Visual Studio 2017 the Visual Studio 2017 installer throws a TypeInitializationException whenever I select a version of Visual Studio to install.
The log file shows the following stack trace:
2017-05-25T17:19:18 : Verbose : Getting product. [installerId: SetupEngine, productId: Microsoft.VisualStudio.Product.Community].
2017-05-25T17:19:21 : Error : Failed to get product. [installerId: SetupEngine, productId: Microsoft.VisualStudio.Product.Community, error: TypeInitializationException at The type initializer for 'Microsoft.VisualStudio.Setup.Utility.StringUtility' threw an exception.
at Microsoft.VisualStudio.Setup.Utility.StringUtility.ReplaceSpecialFolders(String value)
at Microsoft.VisualStudio.Setup.Utility.StringUtility.ReplaceVariables(String value, IEnumerable`1 parameters)
at Microsoft.VisualStudio.Setup.ProductInstaller.GetSerializableProduct()
at Microsoft.VisualStudio.Setup.ProductsProviderService.GetProduct(String channelId, String productId)]
Unfortunately I've been unable to correct this. I've redownload the installer. uninstalled and removed anything related to VS2017, rebooted, cleaned the temp folder. Nothing seems to have any affect.
I've asked Microsoft for guidance here, but two similar bug reports here and here stay unanswered, so I've got little hope.
I would look at the source code for the StringUtility class that seems to cause the problem. But I do not believe that is open source. (I could not find a similar class on referencesource). I would also try to debug the running application by attaching a debugger, but alas I have no Visual Studio and can't install a new one :).
Does anybody have any clue how I could try to figure out what causes this Exception? Or what dependencies I could check?
Edit: after using Collect.exe to gather more information I've found the InnerException:
05/25/2017 17:55:17 : Error : System.TypeInitializationException: The type initializer for 'Microsoft.VisualStudio.Setup.Utility.StringUtility' threw an exception. ---> System.ArgumentException: Absolute path information is required.
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Environment.InternalGetFolderPath(SpecialFolder folder, SpecialFolderOption option, Boolean suppressSecurityChecks)
at Microsoft.VisualStudio.Setup.Utility.StringUtility..cctor()
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Setup.Utility.StringUtility.ReplaceSpecialFolders(String value)
at Microsoft.VisualStudio.Setup.Utility.StringUtility.ReplaceVariables(String value, IEnumerable`1 parameters)
at Microsoft.VisualStudio.Setup.ProductInstaller.GetSerializableProduct()
at Microsoft.VisualStudio.Setup.ProductsProviderService.GetProduct(String channelId, String productId)Failed to get a catalog
Looks like there is some sheneningans with an invalid path? But how will I ever find out what path :)?
After another day of searching I figured it out.
Notice how the stack trace includes this line
at System.Environment.InternalGetFolderPath(SpecialFolder folder, SpecialFolderOption option, Boolean suppressSecurityChecks)
So the invalid folder is one of Windows Special Folders. Of which there are only a few. With a Powershell script I tested all Special folders. I then noticed that the following powershell command threw a very similar exception.
[environment]::GetFolderPath("MyVideos")
Digging further I found the following registry key:
Note the missing \ it should be D:\Videos\ not D:Videos I manually edited this a while ago. The path seems to be valid in some Windows functions. But not in the .Net function.
I deleted the Library and then restored the defaults. (Right click, the library in the library pane to delete it. Then right click on the library icon and choose restore defaults.)
After rebooting (without it it wouldn't work) The PS script showed that the Special Folder path worked. And voila! the Visual Studio Installer also worked again :D.
I updated VS2015 to update 2.
Upgrade process finished fine, but after launch a lost access to Team explorer.
There is a bug with the following callstack instead.
An exception was encountered while constructing the content of this frame. This information is also logged in "C:\Users\volkov.a\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml".
Exception details:
System.InvalidOperationException: The window search was not yet setup for this search host.
at Microsoft.VisualStudio.Platform.WindowManagement.WindowSearchHost.ThrowIfSearchNotSetup()
at Microsoft.VisualStudio.Platform.WindowManagement.WindowSearchHost.set_HelpTopic(String value)
at Microsoft.VisualStudio.TeamFoundation.TeamExplorer.ToolWindowTeamExplorer.OnToolWindowCreated()
at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, UInt32 flags)
at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, ProvideToolWindowAttribute tool)
at Microsoft.VisualStudio.Shell.Package.FindToolWindow(Type toolWindowType, Int32 id, Boolean create, ProvideToolWindowAttribute tool)
at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Guid& toolWindowType, Int32 id)
at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsToolWindowFactory.CreateToolWindow(Guid& toolWindowType, UInt32 id)
at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()
I tried repair and reinstall. No result.
Also I'm getting exception on launch:
---------------------------
Microsoft Visual Studio
---------------------------
Error HRESULT E_FAIL has been returned from a call to a COM component.
---------------------------
OK
---------------------------
What else could I check?
I closed the Team Explorer Window then closed visual studio. I Opened visual studio again, went to view menu and click on Team Explorar it throwed a message box whit a exception, tried again open de Team Explorer Windows, and works.
I put Microsoft.TeamFoundation.WorkItemTracking.Client.dll to Gac and that helped.
I installed Visual Studio 2012 Ultimate RC this morning after learning about IntelliTrace at TechEd last week. We currently use VS 2010 Professional, so using the 2012 RC was my only easy option for testing out IntelliTrace.
I opened up VS 2012 Ultimate RC and opened a MVC 3 project that was written in VS 2010. IntelliTrace runs fine if I have it set to "IntelliTrace events only". If I set it to "IntelliTrace events and call information" however, I get an exception when starting the debugger:
System.Reflection.TargetInvocationException was unhandled
HResult=-2146232828
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Web.HttpApplication.InvokeMethodWithAssert(MethodInfo method, Int32 paramCount, Object eventSource, EventArgs eventArgs)
at System.Web.HttpApplication.ProcessSpecialRequest(HttpContext context, MethodInfo method, Int32 paramCount, Object eventSource, EventArgs eventArgs, HttpSessionState session)
at System.Web.HttpApplicationFactory.FireApplicationOnStart(HttpContext context)
at System.Web.HttpApplicationFactory.EnsureAppStartCalled(HttpContext context)
at System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequestNow(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
at Microsoft.VisualStudio.WebHost.Request.Process()
at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)
at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)
at Microsoft.VisualStudio.WebHost.Server.OnSocketAccept(Object acceptedSocket)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
InnerException: System.AccessViolationException
HResult=-2147467261
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
StackTrace:
InnerException:
The problem seems to be somewhere in the function entry to Microsoft.VisualStudio.WebHost.Server.OnSocketAccept. I have no idea what this is though.
I played around some and found that:
The problem doesn't occur if I open a web forms project that was created in VS 2010.
The problem doesn't occur if I create a new MVC 3 project in VS 2012 RC.
The problem only occurs if I open a MVC 3 project that was created in VS 2010.
I'm stumped as to how to try and fix this other than creating a new project in VS 2012 RC and copying all of the code over, which I'd rather not do for every project we have. It could be a bug in VS 2012 RC, I don't know. I'll also note that I'm also getting an error saying "Cannot find or open the PDB file" that appears with the last event in the IntelliTrace output, but not sure if it's connected. Any help would be awesome.
It seems like you are hitting a bug we recently fixed in Intellitrace, but I can't be sure only by looking at the call stack. Can you have a try and let me know whether you can hit the exception when not debugging on "Web Development Server"?
To use IIS server instead of Web Development Server, please open project property, select Web tab, then select "Use local IIS Web Server". Web Development Server is selected by default in project created by VS2010, but the default for VS2012 created project is "IIS Server".