Skip to content

Commit ed52df4

Browse files
committed
Removing invalid stack trace asserts
See - Particular/NServiceBus#2399
1 parent 3307d05 commit ed52df4

File tree

7 files changed

+4
-113
lines changed

7 files changed

+4
-113
lines changed

src/NServiceBus.RabbitMQ.AcceptanceTests/App_Packages/NSB.AcceptanceTests.5.0.0/Exceptions/StackTraceAssert.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ public static void StartsWith(string expected, string actual)
2121
var cleanStackTrace = CleanStackTrace(actual);
2222
try
2323
{
24-
Assert.IsTrue(cleanStackTrace.Replace("\r\n", "\n").StartsWith(expected.Replace("\r\n", "\n")));
24+
var expectedSt = expected.Replace("\r\n", "\n");
25+
var cleanSt = cleanStackTrace.Replace("\r\n", "\n");
26+
27+
Assert.IsTrue(cleanSt.StartsWith(expectedSt), "Clean '{0}' should have started with '{1}'", cleanSt, expectedSt);
2528
}
2629
catch (Exception)
2730
{

src/NServiceBus.RabbitMQ.AcceptanceTests/App_Packages/NSB.AcceptanceTests.5.0.0/Exceptions/When_Uow_Begin_and_different_End_throws.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,6 @@ public void Should_receive_AggregateException_with_both_exceptions()
2525

2626
Assert.AreEqual(typeof(BeginException), context.InnerExceptionOneType);
2727
Assert.AreEqual(typeof(EndException), context.InnerExceptionTwoType);
28-
29-
30-
#if (!DEBUG)
31-
32-
StackTraceAssert.StartsWith(
33-
@"at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next)
34-
at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next)
35-
at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next)
36-
at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context)
37-
at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message)
38-
at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message)", context.StackTrace);
39-
40-
StackTraceAssert.StartsWith(
41-
string.Format(@"at NServiceBus.AcceptanceTests.Exceptions.When_Uow_Begin_and_different_End_throws.Endpoint.{0}.End(Exception ex)
42-
at NServiceBus.UnitOfWorkBehavior.AppendEndExceptionsAndRethrow(Exception initialException)", context.TypeName), context.InnerExceptionTwoStackTrace);
43-
44-
#endif
45-
4628
}
4729

4830
public class Context : ScenarioContext

src/NServiceBus.RabbitMQ.AcceptanceTests/App_Packages/NSB.AcceptanceTests.5.0.0/Exceptions/When_Uow_Begin_throws.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ public void Should_receive_exception_thrown_from_begin()
2424
.Run();
2525

2626
Assert.AreEqual(typeof(BeginException), context.ExceptionType);
27-
#if (!DEBUG)
28-
StackTraceAssert.StartsWith(
29-
@"at NServiceBus.AcceptanceTests.Exceptions.When_Uow_Begin_throws.Endpoint.UnitOfWorkThatThrowsInBegin.Begin()
30-
at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next)
31-
at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next)
32-
at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next)
33-
at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context)
34-
at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message)
35-
at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message)", context.StackTrace);
36-
#endif
3727
}
3828

3929
public class Context : ScenarioContext

src/NServiceBus.RabbitMQ.AcceptanceTests/App_Packages/NSB.AcceptanceTests.5.0.0/Exceptions/When_Uow_End_throws.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ public void Should_receive_exception_thrown_from_end()
2424
.Run();
2525

2626
Assert.AreEqual(typeof(EndException), context.ExceptionType);
27-
#if(!DEBUG)
28-
StackTraceAssert.StartsWith(
29-
@"at NServiceBus.AcceptanceTests.Exceptions.When_Uow_End_throws.Endpoint.UnitOfWorkThatThrowsInEnd.End(Exception ex)
30-
at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next)
31-
at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next)
32-
at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next)
33-
at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context)
34-
at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message)
35-
at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message)", context.StackTrace);
36-
#endif
3727
}
3828

3929
public class Context : ScenarioContext

src/NServiceBus.RabbitMQ.AcceptanceTests/App_Packages/NSB.AcceptanceTests.5.0.0/Exceptions/When_handler_and_Uow_End_throws.cs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,6 @@ public void Should_receive_AggregateException_with_both_exceptions()
2525

2626
Assert.AreEqual(typeof(HandlerException), context.InnerExceptionOneType);
2727
Assert.AreEqual(typeof(EndException), context.InnerExceptionTwoType);
28-
29-
#if (!DEBUG)
30-
StackTraceAssert.StartsWith(
31-
@"at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next)
32-
at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next)
33-
at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next)
34-
at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context)
35-
at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message)
36-
at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message)", context.StackTrace);
37-
38-
StackTraceAssert.StartsWith(
39-
@"at NServiceBus.AcceptanceTests.Exceptions.When_handler_and_Uow_End_throws.Endpoint.Handler.Handle(Message message)
40-
at NServiceBus.Unicast.MessageHandlerRegistry.Invoke(Object handler, Object message, Dictionary`2 dictionary)
41-
at NServiceBus.InvokeHandlersBehavior.Invoke(IncomingContext context, Action next)
42-
at NServiceBus.SetCurrentMessageBeingHandledBehavior.Invoke(IncomingContext context, Action next)
43-
at NServiceBus.LoadHandlersBehavior.Invoke(IncomingContext context, Action next)
44-
at NServiceBus.ApplyIncomingMessageMutatorsBehavior.Invoke(IncomingContext context, Action next)
45-
at NServiceBus.ExecuteLogicalMessagesBehavior.Invoke(IncomingContext context, Action next)
46-
at NServiceBus.DeserializeLogicalMessagesBehavior.Invoke(IncomingContext context, Action next)
47-
at NServiceBus.CallbackInvocationBehavior.Invoke(IncomingContext context, Action next)
48-
at NServiceBus.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(IncomingContext context, Action next)
49-
at NServiceBus.SubscriptionReceiverBehavior.Invoke(IncomingContext context, Action next)
50-
at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next)", context.InnerExceptionOneStackTrace);
51-
52-
StackTraceAssert.StartsWith(
53-
string.Format(@"at NServiceBus.AcceptanceTests.Exceptions.When_handler_and_Uow_End_throws.Endpoint.{0}.End(Exception ex)
54-
at NServiceBus.UnitOfWorkBehavior.AppendEndExceptionsAndRethrow(Exception initialException)", context.TypeName), context.InnerExceptionTwoStackTrace);
55-
56-
#endif
5728
}
5829

5930
public class Context : ScenarioContext

src/NServiceBus.RabbitMQ.AcceptanceTests/App_Packages/NSB.AcceptanceTests.5.0.0/Exceptions/When_handler_throws.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,6 @@ public void Should_receive_exception_from_handler()
2222
.Done(c => c.ExceptionReceived)
2323
.Run();
2424
Assert.AreEqual(typeof(HandlerException), context.ExceptionType);
25-
#if (!DEBUG)
26-
StackTraceAssert.StartsWith(
27-
@"at NServiceBus.AcceptanceTests.Exceptions.When_handler_throws.Endpoint.Handler.Handle(Message message)
28-
at NServiceBus.Unicast.MessageHandlerRegistry.Invoke(Object handler, Object message, Dictionary`2 dictionary)
29-
at NServiceBus.InvokeHandlersBehavior.Invoke(IncomingContext context, Action next)
30-
at NServiceBus.SetCurrentMessageBeingHandledBehavior.Invoke(IncomingContext context, Action next)
31-
at NServiceBus.LoadHandlersBehavior.Invoke(IncomingContext context, Action next)
32-
at NServiceBus.ApplyIncomingMessageMutatorsBehavior.Invoke(IncomingContext context, Action next)
33-
at NServiceBus.ExecuteLogicalMessagesBehavior.Invoke(IncomingContext context, Action next)
34-
at NServiceBus.DeserializeLogicalMessagesBehavior.Invoke(IncomingContext context, Action next)
35-
at NServiceBus.CallbackInvocationBehavior.Invoke(IncomingContext context, Action next)
36-
at NServiceBus.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(IncomingContext context, Action next)
37-
at NServiceBus.SubscriptionReceiverBehavior.Invoke(IncomingContext context, Action next)
38-
at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next)
39-
at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next)
40-
at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next)
41-
at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context)
42-
at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message)
43-
at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message)", context.StackTrace);
44-
#endif
4525
}
4626

4727
public class Context : ScenarioContext

src/NServiceBus.RabbitMQ.AcceptanceTests/App_Packages/NSB.AcceptanceTests.5.0.0/Exceptions/When_handler_throws_AggregateException.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,6 @@ public void Should_receive_exact_AggregateException_exception_from_handler()
2525
Assert.AreEqual(typeof(Exception), context.InnerExceptionType);
2626
Assert.AreEqual("My Exception", context.ExceptionMessage);
2727
Assert.AreEqual("My Inner Exception", context.InnerExceptionMessage);
28-
29-
#if (!DEBUG)
30-
StackTraceAssert.StartsWith(
31-
@"at NServiceBus.AcceptanceTests.Exceptions.When_handler_throws_AggregateException.Endpoint.Handler.Handle(Message message)
32-
at NServiceBus.Unicast.MessageHandlerRegistry.Invoke(Object handler, Object message, Dictionary`2 dictionary)
33-
at NServiceBus.InvokeHandlersBehavior.Invoke(IncomingContext context, Action next)
34-
at NServiceBus.SetCurrentMessageBeingHandledBehavior.Invoke(IncomingContext context, Action next)
35-
at NServiceBus.LoadHandlersBehavior.Invoke(IncomingContext context, Action next)
36-
at NServiceBus.ApplyIncomingMessageMutatorsBehavior.Invoke(IncomingContext context, Action next)
37-
at NServiceBus.ExecuteLogicalMessagesBehavior.Invoke(IncomingContext context, Action next)
38-
at NServiceBus.DeserializeLogicalMessagesBehavior.Invoke(IncomingContext context, Action next)
39-
at NServiceBus.CallbackInvocationBehavior.Invoke(IncomingContext context, Action next)
40-
at NServiceBus.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(IncomingContext context, Action next)
41-
at NServiceBus.SubscriptionReceiverBehavior.Invoke(IncomingContext context, Action next)
42-
at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next)
43-
at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next)
44-
at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next)
45-
at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context)
46-
at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message)
47-
at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message)", context.StackTrace);
48-
49-
StackTraceAssert.StartsWith(
50-
@"at NServiceBus.AcceptanceTests.Exceptions.When_handler_throws_AggregateException.Endpoint.Handler.MethodThatThrows()
51-
at NServiceBus.AcceptanceTests.Exceptions.When_handler_throws_AggregateException.Endpoint.Handler.Handle(Message message)", context.InnerStackTrace);
52-
#endif
5328
}
5429

5530
public class Context : ScenarioContext

0 commit comments

Comments
 (0)