Examples of errors detected by the V3052 diagnostic.

V3052. The original exception object was swallowed. Stack of original exception could be lost.


Xamarin.Forms

V3052 The original exception object 'ex' was swallowed. Stack of original exception could be lost. Xamarin.Forms.Core.UnitTests ImageTests.cs 221


static async Task<Stream>
GetStreamAsync (Uri uri, CancellationToken cancellationToken)
{
  try {
    await Task.Delay (5000, cancellationToken);
  } catch (TaskCanceledException ex) {
    cancelled = true;
    throw ex;
  }
  ....
}

Xamarin.Forms

V3052 The original exception object 'ae' was swallowed. Stack of original exception could be lost. Xamarin.Forms.Xaml RegisterXNamesVisitor.cs 38


public void Visit(ValueNode node, INode parentNode)
{
  ....
  try
  {
    ....
  }
  catch (ArgumentException ae)
  {
    if (ae.ParamName != "name")
      throw ae;
    throw new XamlParseException(
      string.Format("An element with the name \"{0}\"
                     already exists in this NameScope",
                    (string)node.Value), node);
  }
}

FlashDevelop

V3052 The original exception object 'uex' was swallowed. Stack of original exception could be lost. FileActions.cs 598


public void Copy(string fromPath, string toPath)
{
  ....
  try
  {
    ....
  }
  catch (UserCancelException uex)
  {
    throw uex;
  }
  ....
}

SharpDevelop

V3052 The original exception object 'ex' was swallowed. Stack of original exception could be lost. ReferenceFolderNodeCommands.cs 130


DiscoveryClientProtocol DiscoverWebServices(....)
{
  try {
    ....
  } catch (WebException ex) {
    if (....) {
      ....
    } else {
      throw ex;
    }
  }
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;