BaptX
BaptX

Reputation: 589

System.ArgumentException - caption cannot be an empty string

I'm trying to load an existing solution in Visual Studio 2022. One of projects in this solution is in error : enter image description here

A message appears at top of the main window :

Visual Studio ran into an uexpected problem with one or more projects. You may need to reload affected projects or the solution to prevent further problems.

There are the logs when I click on "Open log file" :

=====================
11/07/2023 15:01:43
LimitedFunctionality
System.AggregateException: One or more errors occurred.
---> (Inner Exception #0) System.ArgumentException: 'caption' cannot be an empty string ("") or start with the null character.
Parameter name: caption
   at Microsoft.Requires.NotNullOrEmpty(String value, String parameterName)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.GetDebuggerTargets(IPropertyPagesCatalog catalog, IImmutableDictionary`2 dynamicTargets)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.<LinkExternalInput>b__38_1(IProjectVersionedValue`1 bunch)
   at Microsoft.VisualStudio.ProjectSystem.TransformBlockSlim`2.TransformBlockSlimSync.ProcessInputAsync(TInput input)
   at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1.<ProcessInputQueueAsync>d__5.MoveNext()
<--- (Inner Exception #0) 
===================
11/07/2023 15:01:43
LimitedFunctionality
System.AggregateException: Project system data flow 'DebugTargetsSubscriptionService: 59778726' closed because of an exception.
'caption' cannot be an empty string ("") or start with the null character.
Parameter name: caption
---> (Inner Exception #0) System.ArgumentException: 'caption' cannot be an empty string ("") or start with the null character.
Parameter name: caption
   at Microsoft.Requires.NotNullOrEmpty(String value, String parameterName)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.GetDebuggerTargets(IPropertyPagesCatalog catalog, IImmutableDictionary`2 dynamicTargets)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.<LinkExternalInput>b__38_1(IProjectVersionedValue`1 bunch)
   at Microsoft.VisualStudio.ProjectSystem.TransformBlockSlim`2.TransformBlockSlimSync.ProcessInputAsync(TInput input)
   at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1.<ProcessInputQueueAsync>d__5.MoveNext()
<--- (Inner Exception #0) 
===================

When I check the activity log, there are errors :

      <entry>
    <record>468</record>
    <time>2023/07/11 13:09:52.917</time>
    <type>Error</type>
    <source>CPS</source>
    <description>CPS &apos;LimitedFunctionality&apos; in project &apos;C:\xxx\xxx\xxx.csproj&apos; failure: System.ArgumentException: &apos;caption&apos; cannot be an empty string (&quot;&quot;) or start with the null character.&#x000D;&#x000A;Parameter name: caption  Call Stack:    at Microsoft.Requires.NotNullOrEmpty(String value, String parameterName)&#x000D;&#x000A;   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.GetDebuggerTargets(IPropertyPagesCatalog catalog, IImmutableDictionary`2 dynamicTargets)&#x000D;&#x000A;   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.&lt;LinkExternalInput&gt;b__38_1(IProjectVersionedValue`1 bunch)&#x000D;&#x000A;   at Microsoft.VisualStudio.ProjectSystem.TransformBlockSlim`2.TransformBlockSlimSync.ProcessInputAsync(TInput input)&#x000D;&#x000A;   at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1.&lt;ProcessInputQueueAsync&gt;d__5.MoveNext()</description>
  </entry>
  <entry>
    <record>469</record>
    <time>2023/07/11 13:09:52.917</time>
    <type>Error</type>
    <source>CPS</source>
    <description>CPS &apos;LimitedFunctionality&apos; in project &apos;C:\xxx\xxx\xxx.csproj&apos; failure: System.ArgumentException: &apos;caption&apos; cannot be an empty string (&quot;&quot;) or start with the null character.&#x000D;&#x000A;Parameter name: caption  Call Stack:    at Microsoft.Requires.NotNullOrEmpty(String value, String parameterName)&#x000D;&#x000A;   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.GetDebuggerTargets(IPropertyPagesCatalog catalog, IImmutableDictionary`2 dynamicTargets)&#x000D;&#x000A;   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.DebugTargetsSubscriptionService.&lt;LinkExternalInput&gt;b__38_1(IProjectVersionedValue`1 bunch)&#x000D;&#x000A;   at Microsoft.VisualStudio.ProjectSystem.TransformBlockSlim`2.TransformBlockSlimSync.ProcessInputAsync(TInput input)&#x000D;&#x000A;   at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1.&lt;ProcessInputQueueAsync&gt;d__5.MoveNext()</description>
  </entry>
  <entry>

...

  <entry>
    <record>569</record>
    <time>2023/07/11 13:10:23.379</time>
    <type>Error</type>
    <source>Microsoft.VisualStudio.ComponentModelHost.VsShellComponentModelHost</source>
    <description>A MEF Component threw an exception at runtime: System.ObjectDisposedException: Cannot access a disposed object.&#x000D;&#x000A;Object name: &apos;Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory+RuntimeExportProvider+RuntimePartLifecycleTracker&apos;.&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.ThrowIfDisposed()&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.ConstructExportedValue(RuntimeImport import, RuntimeExport export, RuntimePartLifecycleTracker importingPartTracker, PartLifecycleTracker partLifecycle, ReportFaultCallback faultCallback)</description>
  </entry>
  <entry>
    <record>570</record>
    <time>2023/07/11 13:10:23.405</time>
    <type>Error</type>
    <source>Microsoft.VisualStudio.ComponentModelHost.VsShellComponentModelHost</source>
    <description>A MEF Component threw an exception at runtime: System.ObjectDisposedException: Cannot access a disposed object.&#x000D;&#x000A;Object name: &apos;Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory+RuntimeExportProvider+RuntimePartLifecycleTracker&apos;.&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.ThrowIfDisposed()&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.ConstructExportedValue(RuntimeImport import, RuntimeExport export, RuntimePartLifecycleTracker importingPartTracker, PartLifecycleTracker partLifecycle, ReportFaultCallback faultCallback)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetExportedValue(RuntimeImport import, RuntimeExport export, RuntimePartLifecycleTracker importingPartTracker, Boolean lazy, PartLifecycleTracker&amp; partLifecycle)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.&lt;CreateValue&gt;b__11_0(RuntimeImport import)&#x000D;&#x000A;   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()&#x000D;&#x000A;   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)&#x000D;&#x000A;   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()&#x000D;&#x000A;   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.ConstructExportedValue(RuntimeImport import, RuntimeExport export, RuntimePartLifecycleTracker importingPartTracker, PartLifecycleTracker partLifecycle, ReportFaultCallback faultCallback)</description>
  </entry>

I looked on Google for hours but don't find any tips about this error.

I already tried to remove .vs, bin, obj directories without any success.

Update : When I click on "Reload faulted project(s)", the error disappears because the project is not selected anymore. The error appears again only when I select the project. If I unload / reload the project (right-click), the error reappears because the project is still selected.

enter image description here

Upvotes: 2

Views: 249

Answers (1)

behzad
behzad

Reputation: 21

open 'launchSettings.json' in 'Properties' folder in the project structure and set the name for the first index of the profiles array.

{
  "profiles": {
    "[Set Name Here]": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:59006;http://localhost:59007"
    }
  }
}

Upvotes: 0

Related Questions