Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in VS 2019 during publish after updating to 2.0.48 (Method not found CacheService.get_CacheFolder()) #481

Closed
NikolayIT opened this issue May 17, 2019 · 7 comments

Comments

@NikolayIT
Copy link

commented May 17, 2019

Exception occurred in VS 2019 (16.0.4) after updating to 2.0.48. Happens only when I try to publish my Web project to IIS.

Running it locally doesn't produce this error.

Publishing it with VS 2017 doesn't produce the error.

Exception details:

Restore operation started...
C:\Users\Nikolay\.nuget\packages\microsoft.web.librarymanager.build\2.0.48\build\Microsoft.Web.LibraryManager.Build.targets(35,9): Error MSB4018: The "Microsoft.Web.LibraryManager.Build.RestoreTask" task failed unexpectedly.
System.AggregateException: One or more errors occurred. ---> System.MissingMethodException: Method not found: 'System.String Microsoft.Web.LibraryManager.CacheService.get_CacheFolder()'.
   at Microsoft.Web.LibraryManager.Build.HostInteraction.get_CacheDirectory()
   at Microsoft.Web.LibraryManager.Providers.Unpkg.UnpkgProvider.get_CacheFolder()
   at Microsoft.Web.LibraryManager.Providers.Unpkg.UnpkgCatalog..ctor(UnpkgProvider provider)
   at Microsoft.Web.LibraryManager.Providers.Unpkg.UnpkgProvider.GetCatalog()
   at Microsoft.Web.LibraryManager.Extensions.<IsValidAsync>d__1.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.Web.LibraryManager.Extensions.<IsValidAsync>d__0.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.Web.LibraryManager.LibrariesValidator.<ValidatePropertiesAsync>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.Web.LibraryManager.LibrariesValidator.<GetLibrariesErrorsAsync>d__0.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.Web.LibraryManager.LibrariesValidator.<GetManifestErrorsAsync>d__1.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.Web.LibraryManager.Manifest.<GetValidationResultsAsync>d__31.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.Web.LibraryManager.Build.RestoreTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
---> (Inner Exception #0) System.MissingMethodException: Method not found: 'System.String Microsoft.Web.LibraryManager.CacheService.get_CacheFolder()'.
   at Microsoft.Web.LibraryManager.Build.HostInteraction.get_CacheDirectory()
   at Microsoft.Web.LibraryManager.Providers.Unpkg.UnpkgProvider.get_CacheFolder()
   at Microsoft.Web.LibraryManager.Providers.Unpkg.UnpkgCatalog..ctor(UnpkgProvider provider)
   at Microsoft.Web.LibraryManager.Providers.Unpkg.UnpkgProvider.GetCatalog()
   at Microsoft.Web.LibraryManager.Extensions.<IsValidAsync>d__1.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.Web.LibraryManager.Extensions.<IsValidAsync>d__0.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.Web.LibraryManager.LibrariesValidator.<ValidatePropertiesAsync>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.Web.LibraryManager.LibrariesValidator.<GetLibrariesErrorsAsync>d__0.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.Web.LibraryManager.LibrariesValidator.<GetManifestErrorsAsync>d__1.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.Web.LibraryManager.Manifest.<GetValidationResultsAsync>d__31.MoveNext()<---

@NikolayIT NikolayIT changed the title Exception during publish after updating to 2.0.48 (Method not found CacheService.get_CacheFolder()) Exception in VS 2019 during publish after updating to 2.0.48 (Method not found CacheService.get_CacheFolder()) May 17, 2019

@jimmylewis jimmylewis self-assigned this May 17, 2019

@jimmylewis

This comment has been minimized.

Copy link
Contributor

commented May 17, 2019

@NikolayIT can you give a little more specifics about the action that doesn't work vs what does? The error is from the build package, so I'm trying to understand:

  • how this is used in your publish pipeline and how that's different from "running it locally"
  • how this is specific to VS2019 and not VS2017, since the build package should be IDE agnostic. Maybe the first point will differentiate this.
@jwillmer

This comment has been minimized.

Copy link

commented May 20, 2019

Reference #480

@jodavis jodavis added the P1 label May 21, 2019

@jimmylewis

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

I was able to reproduce this (or technically, the reverse version of it that I mention below). The issue occurs because during publish, VS does a build where it hosts MSBuild in-proc, which loads the Microsoft.Web.LibraryManager.Build.dll into the VS process. However, by this point, the other LibMan DLLs (specifically Microsoft.Web.LibraryManager.Contracts.dll and Microsoft.Web.LibraryManager.dll, which the Build.dll depends on)
were loaded based on the VS version of LibMan, rather than the ones coupled in the NuGet package like when MSBuild normally runs (out of proc).

The crux of this is that here was a breaking change in the 2.0.48 version (which is the version shipping in VS 16.1). This error occurs when you use the newer Build NuGetPackage in an older VS build while publishing through VS (or vice versa, you'll get a different MissingMethodException for a 16.1+ VS with the 1.0.172 Build package as well).

I'm looking into whether it's possible to make VS publish use an out-of-proc build. Other than the following workarounds, I don't think there's a good fix for this issue.

Workarounds:

  • Update VS to 16.1 so that it's compatible with the 2.0.48 Build package.
  • Downgrade the Microsoft.Web.LibraryManager.Build package to 1.0.172 (until you upgrade VS because at that point you'll need to update the NuGet package to stay in sync)

This is a scenario that we'll have to keep in mind when we introduce potentially breaking changes in the future. /cc @alexgav and @jodavis as an FYI.

@IrakliLomidze

This comment has been minimized.

Copy link

commented May 26, 2019

I have 16.1 Version But Still have same issue

C:\Users\irakl.nuget\packages\microsoft.web.librarymanager.build\1.0.172\build\Microsoft.Web.LibraryManager.Build.targets(35,9): Error MSB4018: The "Microsoft.Web.LibraryManager.Build.RestoreTask" task failed unexpectedly.
System.TypeLoadException: Method 'get_Settings' in type 'Microsoft.Web.LibraryManager.Build.HostInteraction' from assembly 'Microsoft.Web.LibraryManager.Build, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
at Microsoft.Web.LibraryManager.Build.Dependencies.FromTask(String workingDirectory, IEnumerable`1 assemblyPaths)
at Microsoft.Web.LibraryManager.Build.RestoreTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()


Line 35: <Microsoft.Web.LibraryManager.Build.RestoreTask
FileName="libman.json"

@jimmylewis

This comment has been minimized.

Copy link
Contributor

commented May 26, 2019

@IrakliLomidze The issue happens in both directions. If you have VS 16.1, you need to update to the 2.0.48 version of the LibraryManager.Build package.

@IrakliLomidze

This comment has been minimized.

Copy link

commented May 26, 2019

@jimmylewis, Finally it works
I Did it (Version 2.0.48 but Have same issue) After
we have to delete .vs bin and obj folder and restart VS 2019

@jimmylewis

This comment has been minimized.

Copy link
Contributor

commented May 31, 2019

I confirmed that there isn't a way for publish to run the build outside the VS process, so there isn't really a workaround here other than to match up the versions as mentioned above. Closing this issue.

@jimmylewis jimmylewis closed this May 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.