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...
Related
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.
TFS Error
Error Description: exception has been thrown by the target of an invocation
When I am opening TFS in Visual Studio 2013
I cannot checkin the files also due to this.
First make sure you have run VS with Administrator. And if you have some extensions installed, you can disable them first then do the check in action again.
More ways please refer the similarly question "Exception has been thrown by the target of an invocation." when building a Visual Studio 2010 VSPackage
If above is still not work, you can also try to delete tfs and vs cache (Note: back up your pending changes first).
When I run a Windows Phone 10 project from Visual Studio 2015 then the following exception pops up after the second run:
Exception thrown at 0x61594533 (WindowsXamlDiagnosticsTap.dll) in remote.exe: 0xC0000005: Access violation reading location 0x00000000.
If there is a handler for this exception, the program may be safely continued.
The exception is raised in debug and release mode. Consecutive runs also fail with this exception. The only fix is to restart Visual Studio after each debug run.
Is there a way to disable this xaml debugging tap? Or what could be the reason for the exception?
Regards,
It might be this known issue: https://github.com/Microsoft/WindowsUIDevLabs/issues/75
Disable Live Visual Tree Debugging as a work around for now.
when I connect sqlserver2013 with vs2013 .net4.0 ,I got the error message:
A first chance exception of type 'System.AccessViolationException' occurred in System.Data.dll
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
We just found that this is the problem of Visual Studio 2013.
"Attempted to read or write protected memory" exception occurs in dubugging mode.
You can switch to VS 2012 or 2010 while waiting for an update.
So, I'm using Visual Studio 2010, and in the past week or I'm getting a message from Visual Studio coming up: "Visual Studio has encountered an exception. This may be caused by an extension."
My ActivityLog.xml reveals logs this as the problem:
<entry>
<record>321</record>
<time>2012/09/20 16:52:36.126</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below.
Review the CompositionException.Errors property for more detailed information.
1) Object reference not set to an instance of an object.
Resulting in: An exception occurred while calling the 'OnImportsSatisfied' method on type 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword'.
Resulting in: Cannot activate part 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword'.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword
Resulting in: Cannot get export 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition")' from part 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword'.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition") --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword
at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(ComposablePart part, ExportDefinition export, Boolean isSharedPart)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
at System.ComponentModel.Composition.Primitives.Export.get_Value()
at System.ComponentModel.Composition.ExportServices.GetExportedValueFromLazy[T](Export export)
at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedExportOfTM>b__1()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension](Object errorSource, Lazy`1 provider)</description>
</entry>
<entry>
<record>322</record>
<time>2012/09/20 16:52:36.202</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.
1) Object reference not set to an instance of an object.
Resulting in: An exception occurred while calling the 'OnImportsSatisfied' method on type 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment'.
Resulting in: Cannot activate part 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment'.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment
Resulting in: Cannot get export 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition")' from part 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment'.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition") --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment
at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(ComposablePart part, ExportDefinition export, Boolean isSharedPart)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
at System.ComponentModel.Composition.Primitives.Export.get_Value()
at System.ComponentModel.Composition.ExportServices.GetExportedValueFromLazy[T](Export export)
at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedExportOfTM>b__1()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension](Object errorSource, Lazy`1 provider)</description>
</entry>
There doesn't seem to be any specific action that causes this, sometimes it happens when I first fire up VS, sometimes after I leave my desk for awhile and come back. Also, from the log, it appears to happen right after loading the Visual Studio CSS Editing Package. I have MVC4 installed, maybe it's a problem with the new CSS (CSS3 I think?)
Anyways, just wondering if anybody had run into this before and had some sort of resolution.
seems some VS extension may be causing it to crash. (did you install extension any recently?)
try running VS in safe mode to diagnose the problem.
Run this command and check if VS starts
devenv.exe /safemode
More here
http://blog.meidianto.com/2010/05/16/vs2010-tips-8-got-annoying-visual-studio-2010-error-try-to-run-in-safe-mode/
VS needs Administrator previleges to handle the plugin. So right click VS and click "RUN AS ADMINISTRATOR". It solved for me. Try once.
I had the same error and my ActivityLog.xml showed the following error:
System.ComponentModel.Composition.CompositionException: The
composition produced a single composition error. The root cause is
provided below. Review the CompositionException.Errors property for
more detailed information.
1) No
exports were found that match the constraint:
ContractName Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator
RequiredTypeIdentity Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator
Resulting
in: Cannot set import
'Microsoft.Web.Editor.Composition.ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter.Import
(ContractName="Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator")'
on part
'Microsoft.Web.Editor.Composition.ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter'.
Element:
Microsoft.Web.Editor.Composition.ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter.Import
(ContractName="Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator")
--> Microsoft.Web.Editor.Composition.ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter
at
System.ComponentModel.Composition.CompositionResult.ThrowOnErrors(AtomicComposition
atomicComposition)
at
System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImportsOnce(ComposablePart
part)
at
System.ComponentModel.Composition.Hosting.CompositionContainer.SatisfyImportsOnce(ComposablePart
part)
at
Microsoft.VisualStudio.Composition.NetFxAdapters.CompositionService.SatisfyImportsOnce(ComposablePart
part)
at
System.ComponentModel.Composition.AttributedModelServices.SatisfyImportsOnce(ICompositionService
compositionService, Object attributedPart)
at
Microsoft.Web.Editor.Composition.ComponentLocator`1.Import()
at
Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.LinterUtilities.<>c.<.cctor>b__4_1()
at System.Lazy`1.CreateValue()
at
System.Lazy`1.LazyInitValue()
at
System.Lazy`1.get_Value()
at
Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.LinterUtilities.IsFileSupported(String
fileName)
at
Microsoft.VisualStudio.Web.Editor.Package.Lint.ErrorTagger.LintErrorTaggerProvider.CreateTagger[T](ITextBuffer
textBuffer)
at
Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.GatherTaggers(ITextBuffer
textBuffer)
Solved it by going to Tools -> Extensions and Updates -> Updates -> Visual Studio Gallery -> Installed the new version of Microsoft ASP.NET and Web Tools
(The following solution worked for me)
I just clicked on the solution file and by default it has tried to open the *.sln file in visual studio 2015 and then I have got the error message "Visual Studio has encountered an exception. This may be caused by an extension".
I had two visual studio version installed - visual studio 2015 & visual studio 2017. I opened the *.sln file in notepad and I could see VisualStudioVersion = 14.0.24720.0 which indicates the solution was created in visual studio 2015.
Then I right clicked the *.sln file and choose the vs 2017 to open it. Then it has open successfully. My best guess is one of the visual studio 2015 extension was not loading correctly and that is why I was receiving that error message.
Try this
Tools->Import and export settings->Reset all settings.
Download web essentials for your VS version. It sorted my issue regarding ActivityLog.xml.
Web Essential