StefanKert / BuildVision

A Visual Studio extension to visualize the building process.
MIT License
261 stars 43 forks source link

BuildVision fails when VS loads a solution #97

Closed ghost closed 6 months ago

ghost commented 4 years ago

I'm running a fresh install of VS 2019 Professional version 16.5.4. BuildVision 3.0.0.104 is installed.

On loading a solution while VS starts, I get a popup "The 'BuildVisionPackage' package did not correctly. The problem may have been caused by a configuration change or the installation of another extension. You can get more information by examining the file

Restarting VS or Windows didn't help, the error reoccurred. The solution is on .NET Framework 4.6.1.

The log contains the following error:

CreateInstance failed for package [BuildVisionPackage]Source: 'mscorlib' Description: Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Serilog.LoggerConfiguration Serilog.FileLoggerConfigurationExtensions.File(Serilog.Configuration.LoggerSinkConfiguration, System.String, Serilog.Events.LogEventLevel, System.String, System.IFormatProvider, System.Nullable`1<Int64>, Serilog.Core.LoggingLevelSwitch, Boolean, Boolean, System.Nullable`1<System.TimeSpan>, Serilog.RollingInterval, Boolean, System.Nullable`1<Int32>, System.Text.Encoding)'.
   at BuildVision.Common.Logging.LogManager.CreateLogger()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at BuildVision.Common.Logging.LogManager.ForContext(Type type)
   at BuildVision.Common.Logging.LogManager.ForContext[T]()
   at BuildVision.Core.BuildVisionPackage..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)System.MissingMethodException: Method not found: 'Serilog.LoggerConfiguration Serilog.FileLoggerConfigurationExtensions.File(Serilog.Configuration.LoggerSinkConfiguration, System.String, Serilog.Events.LogEventLevel, System.String, System.IFormatProvider, System.Nullable`1<Int64>, Serilog.Core.LoggingLevelSwitch, Boolean, Boolean, System.Nullable`1<System.TimeSpan>, Serilog.RollingInterval, Boolean, System.Nullable`1<Int32>, System.Text.Encoding)'.
   at BuildVision.Common.Logging.LogManager.CreateLogger()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at BuildVision.Common.Logging.LogManager.ForContext(Type type)
   at BuildVision.Common.Logging.LogManager.ForContext[T]()
   at BuildVision.Core.BuildVisionPackage..ctor()
thoemmi commented 4 years ago

I'm experiencing the same error with VS 2019 Preview (16.7.0 Preview 4) and BuildVision 3.0.1.13:

CreateInstance failed for package [BuildVisionPackage]Source: 'mscorlib' Description: Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Serilog.LoggerConfiguration Serilog.FileLoggerConfigurationExtensions.File(Serilog.Configuration.LoggerSinkConfiguration, System.String, Serilog.Events.LogEventLevel, System.String, System.IFormatProvider, System.Nullable`1<Int64>, Serilog.Core.LoggingLevelSwitch, Boolean, Boolean, System.Nullable`1<System.TimeSpan>, Serilog.RollingInterval, Boolean, System.Nullable`1<Int32>, System.Text.Encoding, Serilog.Sinks.File.FileLifecycleHooks)'.
   at BuildVision.Common.Logging.LogManager.CreateLogger()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at BuildVision.Common.Logging.LogManager.ForContext(Type type)
   at BuildVision.Core.BuildVisionPackage..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)System.MissingMethodException: Method not found: 'Serilog.LoggerConfiguration Serilog.FileLoggerConfigurationExtensions.File(Serilog.Configuration.LoggerSinkConfiguration, System.String, Serilog.Events.LogEventLevel, System.String, System.IFormatProvider, System.Nullable`1<Int64>, Serilog.Core.LoggingLevelSwitch, Boolean, Boolean, System.Nullable`1<System.TimeSpan>, Serilog.RollingInterval, Boolean, System.Nullable`1<Int32>, System.Text.Encoding, Serilog.Sinks.File.FileLifecycleHooks)'.
   at BuildVision.Common.Logging.LogManager.CreateLogger()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at BuildVision.Common.Logging.LogManager.ForContext(Type type)
   at BuildVision.Core.BuildVisionPackage..ctor()
StefanKert commented 4 years ago

Hi @thoemmi ,

that is pretty weird. I am currently not able to reproduce this issue. Could you add a screenshot of your BuildVision Installdir? You should find it depending on your Visual Studio version in the Local AppData folder. For me the path is

%localappdata%\Microsoft\VisualStudio\16.0_85623757\Extensions\e4jutkrq.cnx

If you have installed just a single verison of Visual just head to

%localappdata%\Microsoft\VisualStudio\

Navigate to the folder for your current visual studio version and then to extensions. In this folder you have multiple installed extensions and the name is chosen randomly so you will have to check each. I will add an option to BuildVision to go there directly in the next version but for now this is probably the easiest way. For me it looks like this:

image

Thanks a lot 👍

thoemmi commented 4 years ago

@StefanKert , here's a screenshot of BuildVision's installdir, including the version columns: image

The strange is that it only happens when I open certain solutions. I just haven't recognized any pattern yet.

yuakihiro commented 4 years ago

Because of GitHub Extension or so. DLL Version Conflict see serilog/serilog-sinks-file#159

OzBob commented 4 years ago

I've got v 3.0.1.13 on VS 2019 16.6.2 and am getting the same error:

  <entry>
    <record>989</record>
    <time>2020/08/11 02:38:27.202</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [BuildVisionPackage]Source: 'mscorlib' Description: Exception has been thrown by the target of an invocation.
;System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; System.MissingMethodException: Method not found: 'Serilog.LoggerConfiguration Serilog.FileLoggerConfigurationExtensions.File(Serilog.Configuration.LoggerSinkConfiguration, System.String, Serilog.Events.LogEventLevel, System.String, System.IFormatProvider, System.Nullable`1&lt;Int64&gt;, Serilog.Core.LoggingLevelSwitch, Boolean, Boolean, System.Nullable`1&lt;System.TimeSpan&gt;, Serilog.RollingInterval, Boolean, System.Nullable`1&lt;Int32&gt;, System.Text.Encoding, Serilog.Sinks.File.FileLifecycleHooks)'.
;   at BuildVision.Common.Logging.LogManager.CreateLogger()
...
;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)System.MissingMethodException: Method not found: 'Serilog.LoggerConfiguration Serilog.FileLoggerConfigurationExtensions.File(Serilog.Configuration.LoggerSinkConfiguration, System.String, Serilog.Events.LogEventLevel, System.String, System.IFormatProvider, System.Nullable`1&lt;Int64&gt;, Serilog.Core.LoggingLevelSwitch, Boolean, Boolean, System.Nullable`1&lt;System.TimeSpan&gt;, Serilog.RollingInterval, Boolean, System.Nullable`1&lt;Int32&gt;, System.Text.Encoding, Serilog.Sinks.File.FileLifecycleHooks)'.
;   at BuildVision.Common.Logging.LogManager.CreateLogger()
...
;   at BuildVision.Common.Logging.LogManager.ForContext(Type type)
;   at BuildVision.Core.BuildVisionPackage..ctor()</description>
    <guid>{837C3C3B-8382-4839-9C9A-807B758A929F}</guid>
    <hr>80004005 - E_FAIL</hr>
    <errorinfo></errorinfo>
  </entry>

image

No error on VS2019 preview 16.7.0 preivew 2.0 opening the same project, with the listing of it's directory as: image

yuakihiro commented 4 years ago

@OzBob you also install github extension or other extension? github extension have older assembly(dll) and conflict with BuildVision(newer assembly)

thoemmi commented 4 years ago

I can confirm that GitHub's version of Serilog.dll ist out-dated.

I've run following command in both the user and the application extensions path:

gci serilog.* -Recurse | % { [pscustomobject]@{ Name=(Resolve-Path $_ -Relative); Version=[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileVersion }}

In the user extensions folder Serilog is only used by BuildVision:

Name                                         Version
----                                         -------
.\12klbayc.p2q\Serilog.dll                   2.9.0.0
.\12klbayc.p2q\Serilog.Enrichers.Process.dll 2.0.1.0
.\12klbayc.p2q\Serilog.Enrichers.Thread.dll  3.1.0.0
.\12klbayc.p2q\Serilog.Sinks.File.dll        4.1.0.0

However, in the application extension folder serilog is found in the subfolders of both GitHub and Xamarin:

Name                                          Version
----                                          -------
.\GitHub\GitHub\Serilog.dll                   2.5.0.0
.\GitHub\GitHub\Serilog.Enrichers.Process.dll 2.0.1.0
.\GitHub\GitHub\Serilog.Enrichers.Thread.dll  3.0.0.0
.\GitHub\GitHub\Serilog.Sinks.File.dll        3.2.0.0
.\Xamarin.VisualStudio\hotrestart\Serilog.dll 2.8.0.0
StefanKert commented 4 years ago

Hi folks!

Thanks for the detailed analysis of this issue :). This really saved me some time. I just created a .vsix package with a downgraded Serilog version. I am currently not able to reproduce it, so if somebody that is facing this issue could check it I´d greatly appreciate it :).

BuildVision_3_0_2_preview.zip

Anheledir commented 4 years ago

I can confirm that the exception is gone for me with that 3.0.2 preview (on VS2019) 👍

ktopanov commented 4 years ago

I can confirm that the exception is gone for me with that 3.0.2 preview (MS Visual Studio 2017).

thoemmi commented 4 years ago

I have not experienced the issue w/ 3.0.2 in VS2019 Preview anymore, too. 👍

ghost commented 4 years ago

Installed that 3.0.2 preview, so far no more errors

StefanKert commented 4 years ago

Thanks for testing folks!

I´ll try to bring in another fix (#103) and release 3.0.2 by the end of this week.

EugeneSasin commented 2 years ago

Hello! The bug is back. I once caught this error when I was using the latest (3.1.0) version. I installed versions 3.0.2 and 2.1.1 and the bug was fixed the first time I started VS. But it returned after restarting VS. I use VS 2017 image

OzBob commented 2 years ago

@EugeneSasin can you try installing and testing on VS2022

OzBob commented 2 years ago

112

" v3.1.0 with VS 2022 support has just been pushed to the Marketplace." " Any feedback is greatly appreciated. If you have troubles setting up the VSIX Gallery in VS checkout this guide https://github.com/StefanKert/BuildVision#preview-builds-for-buildvision "

hvanbrug commented 1 year ago

I just re-installed this extension after a few years. I now am getting this same issue. I am using v3.1.0.7 on VS2022 v17.4.4. I do have an extension gallery set up for BuildVision, but there appears to not be anything newer yet. Is this being worked on? Please let me know if I can get you more details.

kevinbabcock commented 8 months ago

I just re-installed this extension after a few years. I now am getting this same issue. I am using v3.1.0.7 on VS2022 v17.4.4. I do have an extension gallery set up for BuildVision, but there appears to not be anything newer yet. Is this being worked on? Please let me know if I can get you more details.

Same. Just installed it after several years and getting this error. I am on BuildVision v3.1.0.7 and VS 2022 Enterprise 17.8.1.

Here's the error that is logged after trying to load the extension:

SetSite failed for package [BuildVisionPackage]Source: 'Microsoft.VisualStudio.Validation' Description: Cannot find an instance of the Microsoft.VisualStudio.Shell.Interop.IVsSolutionBuildManager5 service.

StefanKert commented 6 months ago

Hi folks,

so I believe that this is fixed in the upcoming 4.0.0 release. You can grab the latest release from the VSIXGallery https://github.com/stefankert/buildvision?tab=readme-ov-file#setup-visual-studio-for-preview-channel. I will close this issue since it is right now hard to keep trackof the different "vs 2022 not working" issues, so if there are still issues with the vsix please create another issue. Thank you very much

gabriel-vanca commented 2 months ago

Can confirm v4 fixes the problem