Examples of errors detected by the V3006 diagnostic


V3006. The object was created but it is not being used. The 'throw' keyword could be missing.


Unity3D

V3006 The object was created but it is not being used. The 'throw' keyword could be missing: throw new ApplicationException(FOO). AssetBundleDemo AssetBundleManager.cs 446


static protected bool LoadAssetBundleInternal(....)
{
  ....
  if (....)
  {
    new ApplicationException("Can't load bundle " + ....); // <=
  }

  ....
}

Azure PowerShell

V3006 The object was created but it is not being used. The 'throw' keyword could be missing: throw new ArgumentException(FOO). StartAzureRmRecoveryServicesAsrTestFailoverJob.cs 259


private void StartRPITestFailover()
{
  ....
  if (....)
  {
    ....
  }
  else
  {
    new ArgumentException(
      Resources
        .UnsupportedDirectionForTFO); // Throw Unsupported Direction
                                      // Exception
  }
  ....
}

Similar errors can be found in some other places:

  • V3006 The object was created but it is not being used. The 'throw' keyword could be missing: throw new ArgumentException(FOO). StartAzureRmRecoveryServicesAsrTestFailoverJob.cs 305
  • V3006 The object was created but it is not being used. The 'throw' keyword could be missing: throw new ArgumentException(FOO). StartAzureRmRecoveryServicesAsrUnPlannedFailover.cs 278
  • V3006 The object was created but it is not being used. The 'throw' keyword could be missing: throw new ArgumentException(FOO). StartAzureRmRecoveryServicesAsrUnPlannedFailover.cs 322
  • And 2 additional diagnostic messages.


Bugs Found

Checked Projects
364
Collected Errors
13 504