microsoft / DockerTools

Tools For Docker, including Visual Studio Provisioning and Publishing
Other
173 stars 26 forks source link

CTC1030 - Object reference not set to an instance of an object #431

Closed omni-htg closed 2 weeks ago

omni-htg commented 3 weeks ago

Similar to the experience in #276 , my coworker is currently experiencing this error:

Code: CTC1030
Description: Object reference not set to an instance of an object
File: Container.targets
Line: 215

when trying to start debugging a project from the first time they open the solution. In order to make it work, they have to Uninstall and Install the package.

They do have a %Temp%\Microsoft.VisualStudio.Containers.Tools folder, but after triggering the issue again, no log has been generated.

In any case, I can provide the latest entries found in the %Temp%\Microsoft.VisualStudio.Containers.Tools folder:

{
  "timestamp": "2024-06-06 10-20-52.316",
  "message": "An error occurred checking to see if a Docker image can be built.",
  "exception": {
    "ClassName": "System.NotImplementedException",
    "Message": "Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))",
    "Data": null,
    "InnerException": null,
    "HelpURL": null,
    "StackTraceString": "   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)\r\n   at Microsoft.VisualStudio.Containers.Tools.Common.HierarchyBase.FromVsHierarchy(IVsHierarchy vsHierarchy)\r\n   at Microsoft.VisualStudio.Containers.Tools.Common.HierarchyItem..ctor(IVsHierarchy hierarchy, UInt32 itemId)\r\n   at Microsoft.VisualStudio.Containers.Tools.Common.HierarchyItem.FromSelectedItem(IVsMonitorSelection selectionMonitor)\r\n   at Microsoft.VisualStudio.Containers.Tools.Common.Services.VS.VsServiceContextBase`2.<>c__DisplayClass1_0`1.<<RunWithServiceUIAsync>b__0>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.VisualStudio.Containers.Tools.Package.Commands.DockerBuildImageCommandProvider.<>c__DisplayClass6_0.<<CreateCommand>b__3>d.MoveNext()",
    "RemoteStackTraceString": null,
    "RemoteStackIndex": 0,
    "ExceptionMethod": "8\nThrowExceptionForHRInternal\nmscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Runtime.InteropServices.Marshal\nVoid ThrowExceptionForHRInternal(Int32, IntPtr)",
    "HResult": -2147467263,
    "Source": "",
    "WatsonBuckets": null
  }
}

And the %Temp%\Microsoft.VisualStudio.Containers.Tools.Extensions folder:

{
  "timestamp": "2024-06-06 14-21-23.961",
  "message": "Failed to inspect container",
  "exception": {
    "ClassName": "System.InvalidOperationException",
    "Message": "Error: No such object: c43c1289baec",
    "Data": null,
    "InnerException": null,
    "HelpURL": null,
    "StackTraceString": "   at Microsoft.VisualStudio.Containers.Tools.Extensions.Clients.Docker.DockerCommandLineResult.ThrowOnError(Boolean ignoreStandardErrors, Boolean ignoreExitCode)\r\n   at Microsoft.VisualStudio.Containers.Tools.Extensions.Clients.Docker.DockerClient.<ExecuteDockerCommandLineAsync>d__42.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.VisualStudio.Containers.Tools.Extensions.Clients.Docker.DockerClient.<InspectAsync>d__21.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.VisualStudio.Containers.Tools.Extensions.Clients.Docker.DockerClientExtensions.<InspectContainerAsync>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.VisualStudio.Containers.Tools.Extensions.Services.Docker.DockerService.<InspectContainerAsync>d__74.MoveNext()",
    "RemoteStackTraceString": null,
    "RemoteStackIndex": 0,
    "ExceptionMethod": "8\nThrowOnError\nMicrosoft.VisualStudio.Containers.Tools.Extensions.Shared, Version=17.0.2401.501, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\nMicrosoft.VisualStudio.Containers.Tools.Extensions.Clients.Docker.DockerCommandLineResult\nVoid ThrowOnError(Boolean, Boolean)",
    "HResult": -2146233079,
    "Source": "Microsoft.VisualStudio.Containers.Tools.Extensions.Shared",
    "WatsonBuckets": null
  }
}

Their environment is:

Thank you for your assistance!

patverb commented 3 weeks ago

Hello @omni-htg,

I attempted to repo the issue myself and was unable. There is a chance there might be some more info logged in the <ProjectDirectory>\obj\Container\ContainerToolsExceptions.json file but I'm doubtful.

Two things that could help narrow down what the issue might be: 1) Upgrade to VS 17.10 and see if the issue persists. 2) Downgrade the ContainerTools NuGet to 1.19.6

If none of those seem to help, I think I'll need a dump file to debug what is going on. When the exception occurs, at the top of VS select Help -> Send Feedback -> Report A Problem then open an issue on developer community. There you can upload files/messages privately.

omni-htg commented 3 weeks ago

Hey @patverb ! We can try tomorrow, see where it takes us.

I'll need a dump file to debug what is going on

How can we generate this?

Thanks!

omni-htg commented 2 weeks ago

Hello @patverb ! Apologies for the delay. They have updated VS to 17.10.2 and now it doesn't throw the exception again, so we can close this issue out.

When I have time in the following days I will try to install that version of VS again and run the project that failed to try and fish out the <ProjectDirectory>\obj\Container\ContainerToolsExceptions.json file.

Thank you for your assistance.