"Arithmetic Overflow" Exception when generating a PDF with PuppeteerSharp, for a very large webpage - puppeteer-sharp

We are getting the following exception when attempting to generate a PDF for a very large webpage with PuppeteerSharp. I have duplicated this with versions 2.0.3, 2.04 & 4.0 of PuppeteerSharp.
Arithmetic operation resulted in an overflow.
at System.Linq.Buffer1..ctor(IEnumerable1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at PuppeteerSharp.Helpers.ProtocolStreamReader.d__1.MoveNext() in C:\projects\puppeteer-sharp\lib\PuppeteerSharp\Helpers\ProtocolStreamReader.cs:line 83
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at PuppeteerSharp.Page.d__171.MoveNext() in C:\projects\puppeteer-sharp\lib\PuppeteerSharp\Page.cs:line 1003
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

Related

Error after updating Visual Studio to 16.10, Error HRESULT E_FAIL has been returned from a call to a COM component

Since I have updated Visual Studio 2019 to v16.10, I got an error when I try to create new project (WPF App C#, but others such as "Console app'" are working fine), and also I cannot open my projects.
Error is:
Project AAA could not be opened because the Visual C# 2019 language
service could not be created. Error HRESULT E_FAIL has been returned
from a call to a COM component.
ActivityLog (Inside AppData) after I tried to open my project:
Still unable to load MEF component DLL: Could not load file or
assembly 'Microsoft.VisualStudio.LanguageServer.Protocol,
Version=16.9.150.16657, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified.
c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\liveshare.vscore\Microsoft.VisualStudio.LanguageServices.Remote.VSCore.dll
Still unable to load MEF component DLL: Could not load file or
assembly 'Microsoft.VisualStudio.CppSvc.Internal, Version=16.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies. The system cannot find the file specified.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CodeAnalysis\Microsoft.VisualStudio.CodeAnalysis.VCPlugin.dll
SetSite failed for package [CSharpPackage]Source: '' Description:
Package 'RoslynPackage' failed to load. System.ArgumentException:
Package 'RoslynPackage' failed to load.at
Microsoft.VisualStudio.Shell.Interop.IVsTaskBody.DoWork(IVsTask pTask,
UInt32 dwCount, IVsTask[] pParentTasks, Object& pResult)at
Microsoft.VisualStudio.Services.VsTask.<>c__DisplayClass118_0.b__0(Task1[] _)at Microsoft.VisualStudio.Services.VsTask.<>c__DisplayClass119_0.<GetCallbackForSingleParent>b__0(Task1
internalTask)at
System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)at Microsoft.VisualStudio.Services.VsTask.GetResult() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)at Microsoft.VisualStudio.Services.VsTask.GetResult()at Microsoft.Internal.VisualStudio.Shell.VsTaskAwaiter.GetResult()at Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage2.d__5.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.LanguageServices.CSharp.LanguageService.CSharpPackage.d__2.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.Shell.AsyncPackage.<>c__DisplayClass20_0.<b__1>d.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.Shell.UIThreadReentrancyScope.WaitOnTaskCompleteInternal(Task
task, CancellationToken cancel, Int32 ms)at
Microsoft.VisualStudio.Services.VsTask.<>c__DisplayClass100_1.b__1()at
Microsoft.VisualStudio.Services.VsTask.IgnoreObjectDisposedException(Action
action)at
Microsoft.VisualStudio.Services.VsTask.<>c__DisplayClass100_0.b__0()at
Microsoft.VisualStudio.Services.VsTask.<>c__DisplayClass108_0.b__0()at
Microsoft.VisualStudio.Services.VsTask.InvokeWithWaitDialog[T](Func`1
function)at
Microsoft.VisualStudio.Services.VsTask.InvokeWithWaitDialog(Action
action)at
Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean
ignoreUIThreadCheck)at Microsoft.VisualStudio.Services.VsTask.GetResult()
SetSite failed for package [VisualBasicPackage]Source:
'Microsoft.VisualStudio.Shell.UI.Internal' Description: Error HRESULT
E_FAIL has been returned from a call to a COM component.
System.Runtime.InteropServices.COMException (0x80004005): Error
HRESULT E_FAIL has been returned from a call to a COM component.at
Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException
e)at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean
ignoreUIThreadCheck)at
Microsoft.VisualStudio.Services.VsTask.GetResult()at
Microsoft.Internal.VisualStudio.Shell.VsTaskAwaiter.GetResult()at
Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage2.<InitializeAsync>d__5.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.LanguageServices.VisualBasic.VisualBasicPackage.VB$StateMachine_15_InitializeAsync.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.Shell.AsyncPackage.<>c__DisplayClass20_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.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.Shell.UIThreadReentrancyScope.WaitOnTaskCompleteInternal(Task task, CancellationToken cancel, Int32 ms)at Microsoft.VisualStudio.Services.VsTask.<>c__DisplayClass100_1.<InternalGetResult>b__1()at Microsoft.VisualStudio.Services.VsTask.IgnoreObjectDisposedException(Action action)at Microsoft.VisualStudio.Services.VsTask.<>c__DisplayClass100_0.<InternalGetResult>b__0()at Microsoft.VisualStudio.Services.VsTask.<>c__DisplayClass108_0.<InvokeWithWaitDialog>b__0()at Microsoft.VisualStudio.Services.VsTask.InvokeWithWaitDialog[T](Func1
function)at
Microsoft.VisualStudio.Services.VsTask.InvokeWithWaitDialog(Action
action)at
Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean
ignoreUIThreadCheck)at
Microsoft.VisualStudio.Services.VsTask.GetResult()
Tried many solutions, nothing works. Please help me! I'm frustrated.
(Tried to repair, reinstall, remove folders in Appdata (Roaming, Local..), open in safemode, reset settings, reload project, and more)
I have also tried what suggested here: https://learn.microsoft.com/en-us/answers/questions/394256/i-got-error-34the-39csharppackage39-package-did-no.html

Microsoft.Assumes+InternalErrorException: File should not depend on itself. on asp.net core 3.1 visual studio windows

Tried to open a project created in visual studio for mac in Visual Studio 2019 on a Windows VM and received this error.
=====================
8/22/2020 3:14:58 AM
NotRecoverable
Microsoft.Assumes+InternalErrorException: File should not depend on itself.
at Microsoft.Assumes.Fail(String message)
at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.ResolveDependentItems(Dictionary`2 pendingItemsByDirectory)
at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GenerateOriginalTree(ConfiguredProjectExports configuredProjectExports, CancellationToken cancellationToken)
at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.<GenerateOriginalTreeAsync>d__208.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.ProjectSystem.ProjectTreeProviderBase.TreeUpdateSubmission.<UpdateTree>d__19.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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.VisualStudio.ProjectSystem.CoreProjectTreeProviderBase.<>c__DisplayClass76_1.<<Initialize>b__2>d.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.ProjectSystem.CoreProjectTreeProviderBase.<>c__DisplayClass78_0.<<SubmitTreeUpdateCoreAsync>g__waitOnTask|0>d.MoveNext()
RunningInVisualStudio Microsoft.VisualStudio.ProjectSystem.RetailRuntime HostSetActiveProjectConfiguration
===================
I had a similar issue in a proj file setting dependencies for Generated and other dependent files.
In my case dependent file mask File*.cs includes File.cs
<ItemGroup Label="Database"> <Compile Update="Data\File*.cs"> <DependentUpon>File.cs</DependentUpon>

Visual Studio 2019 Won't publish

I've been running a .Core Project in VS 2019 for a while now and I've been building and publishing, but all of the sudden won't publish any more. I've Uninstalled and reinstalled and I get the same error.
So I dug into the Stack Track / log I'm not seeing the issue.
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
--- 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.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.<IsBuildCompletedSuccessfully>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- 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.Publish.Framework.Model.DefaultPublishSteps.<DefaultCorePublishStep>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.Publish.Framework.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__213.MoveNext()
---> (Inner Exception #0) System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <---
System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
===================
I've got nothing.

Microsoft.Bot.Connector.BotState.<GetConversationDataWithHttpMessagesAsync> - Operation returned an invalid status code 'Unauthorized'

I keep getting this exception after my bot is already active for hours. I'm not using any state API, and I've replaced the data store with one from Azure extensions
Conversation.UpdateContainer(builder =>
{
var store = new TableBotDataStore(Configuration.GetConnectionString(MainStorageAccountName));
builder.RegisterModule(new AzureModule(Assembly.GetAssembly(this.GetType())));
builder.Register(c => store)
.Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
.AsSelf()
.SingleInstance();
});
It's ASP.NET Core app, and everything is working fine for hours, before this exception appears. I'm using the latest versions of Nuget packages
Exception:
Microsoft.Bot.Connector.ErrorResponseException: Operation returned an invalid status code 'Unauthorized'
at Microsoft.Bot.Connector.BotState.<GetConversationDataWithHttpMessagesAsync>d__8.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.Bot.Connector.BotStateExtensions.<GetConversationDataAsync>d__7.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.Bot.Builder.Dialogs.Internals.ConnectorStore.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore<Microsoft-Bot-Connector-BotData>-LoadAsync>d__2.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.Bot.Builder.Dialogs.Internals.CachingBotDataStore.<LoadFromInnerAndCache>d__11.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.Bot.Builder.Dialogs.Internals.CachingBotDataStore.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore<Microsoft-Bot-Connector-BotData>-LoadAsync>d__9.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.Bot.Builder.Dialogs.Internals.BotDataBase`1.<LoadData>d__16.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.Bot.Builder.Dialogs.Internals.BotDataBase`1.<LoadAsync>d__8.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.Bot.Builder.Dialogs.Internals.DialogTaskManagerBotDataLoader.<LoadAsync>d__11.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.Bot.Builder.Dialogs.Internals.PersistentDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.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.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__2.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.Bot.Builder.Dialogs.Internals.SerializeByConversation.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__4.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.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.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.Bot.Builder.Dialogs.Internals.LogPostToBot.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.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 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.Skype.ChatService.Bot.Rail.ActivityHandlers.MessageActivityHandler.<HandleAsync>d__4.MoveNext()
the Bot.Builder package is not intended to work with AspNetCore, so basically you are trying to use the SDK in an unsupported way and this is most likely what is causing this error. I am assuming that you are trying to use dialogs while using net core. The SDK was not built with the intention of supporting net core. Take a look at this issue one of our users found a workaround for this which may help you overcome this issue.

The 'Visual Studio Build Manager Package' package did not load correctly

Im using Visual Studio 2017 Community Edition. My laptop suddenly has a problem and I need to do a hard restart.
So after restarting my PC, the problems come out. Every time I open Visual Studio, this message appears:
The solution explorer is also blank, no files are shown there.
When I click properties, it shows an error:
When I try to create a new project, no template is found:
Here is the latest log:
<entry>
<record>1811</record>
<time>2018/04/25 11:24:45.723</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [Visual Studio Build Manager Package]Source: &apos;mscorlib&apos; Description: The process cannot access the file &apos;C:\Users\{user}\AppData\Local\Temp\dfe52bjz.eei&apos; because it is being used by another process.
System.IO.IOException: The process cannot access the file &apos;C:\Users\{user}\AppData\Local\Temp\dfe52bjz.eei&apos; because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at Microsoft.VisualStudio.ExtensibilityHosting.VsExportProviderFactory.<SerializeAssemblyCatalogsAsync>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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.VisualStudio.ExtensibilityHosting.VsExportProviderFactory.VsExportProviderFactoryWorker.<GetCurrentAssemblyCatalogsAsync>d__15.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.VsExportProviderFactoryWorker.<>c__DisplayClass13_0.<<GetCurrentAssemblyCatalogsAsync>b__1>d.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ExtensibilityHosting.VsExportProviderFactory.<GetExportProviderFactoryAsync>d__36.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.<GetMEFV3ExportProviderInternalAsync>d__50.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 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.<GetMEFV3ExportProviderWrapperAsync>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.Threading.AsyncLazy`1.<>c__DisplayClass13_1.<<GetValueAsync>b__0>d.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.GetExtensions[T]()
at Microsoft.VisualStudio.CommonIDE.BuildManager.BuildManagerAccessor.<CreateAsync>d__44.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.CommonIDE.BuildManager.BuildManagerPackage.<>c.<<-cctor>b__11_0>d.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.CommonIDE.ServiceInfo.<>c__DisplayClass15_0.<<ProfferService>b__0>d.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.Shell.AsyncPackage.<>c__DisplayClass22_0.<<AddService>b__1>d.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.AsyncLazy`1.<>c__DisplayClass13_1.<<GetValueAsync>b__0>d.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.CommonIDE.BuildManager.BuildManagerPackage.<InitializeAsync>d__8.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.Shell.AsyncPackage.<>c__DisplayClass16_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)
at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)
at Microsoft.VisualStudio.Services.VsTask.GetResult()</description>
<guid>{B718A162-0361-4B0E-920B-D88D70BE609B}</guid>
<hr>80070020</hr>
<errorinfo></errorinfo>
What I have done:
Repair Visual Studio from Visual Studio Installer - did not solve the problem
Remove folder ComponentModelCache which is located at C:\Users\{User}\AppData\Local\Microsoft\VisualStudio\15.0_616f23f4 - did not solve the problem
How can I fix this without reformatting my computer?
In my case I managed to solve it, modifying the policies so that it allowed me to execute script in the power shell. As he did not have permission, he could not automatically download the packages.
After installing on a new path the problem is gone.

Resources