BuildVision icon indicating copy to clipboard operation
BuildVision copied to clipboard

BuildVision fails when VS loads a solution

Open ghost opened this issue 4 years ago • 18 comments

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()

ghost avatar May 12 '20 08:05 ghost

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()

thoemmi avatar Jul 21 '20 13:07 thoemmi

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 👍

StefanKert avatar Jul 23 '20 07:07 StefanKert

@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.

thoemmi avatar Jul 23 '20 14:07 thoemmi

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

yuakihiro avatar Jul 30 '20 02:07 yuakihiro

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

OzBob avatar Aug 11 '20 02:08 OzBob

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

yuakihiro avatar Aug 11 '20 03:08 yuakihiro

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

thoemmi avatar Aug 11 '20 04:08 thoemmi

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

StefanKert avatar Aug 11 '20 07:08 StefanKert

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

Anheledir avatar Aug 13 '20 15:08 Anheledir

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

ktopanov avatar Aug 13 '20 20:08 ktopanov

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

thoemmi avatar Aug 14 '20 06:08 thoemmi

Installed that 3.0.2 preview, so far no more errors

ghost avatar Aug 14 '20 07:08 ghost

Thanks for testing folks!

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

StefanKert avatar Aug 19 '20 04:08 StefanKert

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

EugeneSasin avatar Feb 23 '22 20:02 EugeneSasin

@EugeneSasin can you try installing and testing on VS2022

OzBob avatar Apr 29 '22 07:04 OzBob

#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 "

OzBob avatar Apr 29 '22 07:04 OzBob

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.

hvanbrug avatar Jun 16 '23 23:06 hvanbrug

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.

kevinbabcock avatar Mar 15 '24 18:03 kevinbabcock

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

StefanKert avatar May 04 '24 05:05 StefanKert