Skip to content

Adding the same exception to the xray trace handler in different subsegments throws a null reference exception #209

@jon-armen

Description

@jon-armen

This code should work, however currently throws a null reference exception because the existing cause does not have an exception associated.

            try
            {
                recorder.BeginSubsegment("child1");
                try
                {
                    try
                    {
                        recorder.BeginSubsegment("child2");
                        throw new AmazonServiceException();
                    }
                    catch (AmazonServiceException e)
                    {
                        recorder.AddException(e);
                        recorder.EndSubsegment();
                        throw;
                    }
                }
                catch (AmazonServiceException e)
                {
                    recorder.AddException(e);
                    recorder.EndSubsegment();
                    throw new EntityNotAvailableException("Dummy message", e);
                }
            }
            catch (EntityNotAvailableException e)
            {
                recorder.AddException(e);
                recorder.EndSegment();
            }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions