"System.ObjectDisposedException: Cannot access a disposed object."

Sysprogs forums Forums VisualGDB "System.ObjectDisposedException: Cannot access a disposed object."

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #21214
    j.jemine
    Participant

    I’m facing this error when creating a simple Linux project (Gnu Make, all default options) in VisualStudio 2017:

    The project ends up being created but not the vgdbsettings files, so it’s a standard C++ project.

    Any idea?

    Full error text

    VisualGDB version: 5.3.18.1973
    —————— System.ObjectDisposedException ——————
    System.ObjectDisposedException: Cannot access a disposed object.
    Object name: ‘Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCConfigurationShim’.
    at Microsoft.Verify.NotDisposed(Boolean condition, Object disposedValue, String message)
    at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCConfigurationShim.<GetRuleAccessGeneralAsync>d__316.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.Project.VisualC.VCProjectEngine.VCConfigurationShim.<GetConfigurationTypeAsync>d__281.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.Project.VisualC.VCProjectEngine.VCConfigurationShim.<<get_ConfigurationType>b__56_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.Project.VisualC.VCProjectEngine.ApartmentMarshaler.<>c__DisplayClass9_0`1.<<Invoke>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.Project.VisualC.VCProjectEngine.ApartmentMarshaler.Invoke[TResult](Func`1 method)
    at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCConfigurationShim.get_ConfigurationType()
    at mw.get_Configurations()
    at w9.h(qp1 f, IProjectEditContext a, z b, String d, String c, vq1 e)
    at g8.f(LinuxWizardState e, qp1 a, String c, String b, hj1 d)
    at g8.DoRunWizardOrThrowException(hj1 c, String a, String b)
    at yv1`1.Execute(Object c, Int32 e, Object[]& a, Object[]& b, wizardResult& d)

     

    Visual studio info

    Microsoft Visual Studio Professional 2017
    Version 15.7.4
    VisualStudio.15.Release/15.7.4+27703.2035
    Microsoft .NET Framework
    Version 4.7.03056

    Installed Version: Professional

    Visual C++ 2017 00369-60000-00001-AA116
    Microsoft Visual C++ 2017

    ASP.NET and Web Tools 2017 15.0.40601.0
    ASP.NET and Web Tools 2017

    C# Tools 2.8.3-beta6-62923-07. Commit Hash: 7aafab561e449da50712e16c9e81742b8e7a2969
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Common Azure Tools 1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

    Debugging Tools for Windows 10.0.17110.1002
    Integrates the Windows Debugger functionality (http://go.microsoft.com/fwlink/?linkid=223405) in Visual Studio.

    JavaScript Language Service 2.0
    JavaScript Language Service

    Microsoft JVM Debugger 1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

    Microsoft MI-Based Debugger 1.0
    Provides support for connecting Visual Studio to MI compatible debuggers

    Microsoft Visual C++ Wizards 1.0
    Microsoft Visual C++ Wizards

    Microsoft Visual Studio VC Package 1.0
    Microsoft Visual Studio VC Package

    NuGet Package Manager 4.6.0
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

    ProjectServicesPackage Extension 1.0
    ProjectServicesPackage Visual Studio Extension Detailed Info

    ResourcePackage Extension 1.0
    ResourcePackage Visual Studio Extension Detailed Info

    Test Adapter for Boost.Test 1.0
    Enables Visual Studio’s testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

    Test Adapter for Google Test 1.0
    Enables Visual Studio’s testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

    TSVN 1.9
    Control TortoiseSVN from within Visual Studio

    Visual Basic Tools 2.8.3-beta6-62923-07. Commit Hash: 7aafab561e449da50712e16c9e81742b8e7a2969
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Visual Studio Code Debug Adapter Host Package 1.0
    Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

    Visual Studio Tools for CMake 1.0
    Visual Studio Tools for CMake

    VisualGDB 5.3
    Allows developing and debugging Embedded, Linux, Android and other GCC/GDB-based applications with Visual Studio.

    Windows Driver Kit 10.0.17110.1002
    Headers, libraries, and tools needed to develop, debug, and test Windows drivers (msdn.microsoft.com/en-us/windows/hardware/gg487428.aspx)

    Windows Machine Learning Generator Extension 1.0
    Windows Machine Learning Visual Studio Extension Detailed Info

    #21215
    j.jemine
    Participant

    I was having the problem when adding a new project to an existing solution.

    It worked when I created the same project in a blank environment. I then copy-pasted the .vgdbsettings files.

    #21223
    support
    Keymaster

    Hi,

    Thanks for the very detailed description. It looks like an internal exception in the Visual Studio Automation logic used by VisualGDB to create some project types. It used to get triggered a lot in early preview builds of VS2017, but was fixed after we filed a bug report with Microsoft. This might be another instance of it, or a completely different bug.

    We tried quickly reproducing it (creating a new Make-based project in a solution that already has a project), but could not get it to crash. As it might be a glitch in one of the recent VS2017 updates, our advice would be to keep on using the workaround until the next VS update (15.8) rolls out. If the issue persists after the next VS update, please try reproducing it from scratch (i.e. first create a new solution with a new project, then add another project) and share the exact choices you make in the wizard so that we could try reproducing it on our side.

    #28315
    cwc-developer
    Participant

    It has started happening with VisualGDB on my machine and also on another developer’s PC – pretty much simultaneously!

    We both run VS2019 v16.4.5 and VisualGDB v5.4 R12.

    The only common theme is that VisualGDB support has expired a few days ago, but it is still a fully licensed copy on both PC’s.

    Does VisualGDB stop creating new projects within an existing solution if its support period has expired???

    Please let us know what is the solution to this, because this sudden symptom on two separate computers looks very questionable.

     

    Alex O.

     

    VisualGDB version: 5.4.112.3309
    —————— System.ObjectDisposedException ——————
    System.ObjectDisposedException: Cannot access a disposed object.
    Object name: ‘Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCConfigurationShim’.
    at Microsoft.Verify.NotDisposed(Boolean condition, Object disposedValue, String message)
    at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCConfigurationShim.<GetRuleAccessGeneralAsync>d__321.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.Project.VisualC.VCProjectEngine.VCConfigurationShim.<GetConfigurationTypeAsync>d__287.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.Project.VisualC.VCProjectEngine.VCConfigurationShim.<<get_ConfigurationType>b__56_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.Project.VisualC.VCProjectEngine.ApartmentMarshaler.<>c__DisplayClass9_0`1.<<Invoke>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.Project.VisualC.VCProjectEngine.ApartmentMarshaler.Invoke[TResult](Func`1 method)
    at Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCConfigurationShim.get_ConfigurationType()
    at dg1.get_Configurations()
    at bi2.u(fs1 e, IProjectEditContext a, h d, String c, String b, wi f)
    at yn.k(LinuxWizardState c, fs1 b, String a, String e, pg d)
    at yn.DoRunWizardOrThrowException(pg b, String a, String c)
    at if2`1.Execute(Object d, Int32 c, Object[]& a, Object[]& e, wizardResult& b)

    #28317
    support
    Keymaster

    Hi,

    Based on the logs you attached, the exception is happening inside the VC++ project engine (Microsoft.VisualStudio.Project.VisualC.VCProjectEngine).

    Most likely, Visual Studio has recently installed a minor update on both computers that started triggering the error. You can try reverting to the previous VS version and check if it resolves the problem, or alternatively report this to Microsoft support and see if they can fix it on their side.

    Based on our experience, the ObjectDisposedException may occur sporadically inside the VC++ project engine, but reloading the solution while deleting the .vs folder often solves it. Either way, if you find this annoying, please consider using the Advanced CMake project subsystem (or other advanced project subsystems shown here). They are not based on the VC++ project type and won’t trigger this error.

    Edit: If you suspect that the VisualGDB’s license checking logic is incorrect, we can temporarily extend the expiration date on your licenses in our system, and you can recheck if it changes anything.

    #28318
    cwc-developer
    Participant

    Support,

    Thank you for your prompt response!

    We can add a new Linux project to a blank Visual Studio solution just not to the one that started throwing the error.
    Tried deleting .vs folder and even the entire solution folder and pulling it again from Git – same error on adding a project to an existing solution.

    Switching to CMake is not a good option for us, since we have a number of projects relying on QMake in this solution, so it is a lot of effort to re-work the entire build system.

    Is the workaround to copy-paste .vsgdbsettings files between those projects from different solutions? Are there any other workaround steps that should be performed?

    Thank you, Alex

    • This reply was modified 4 years, 6 months ago by cwc-developer.
    #28320
    support
    Keymaster

    Sorry, that would qualify as a technical support question and hence we would kindly ask you to renew your licenses, if you would like us to help resolving this.

    If you do not wish to renew, please have a look through our documentation and tutorials. They may contain the answers to your questions.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.