-
Notifications
You must be signed in to change notification settings - Fork 323
Loosen exception matching logic in IsCausedBy<T> #1236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2aa7fcf
475c79b
f9487a9
1328b71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,8 @@ namespace DurableTask.Core.Tests | |||||||||||||
| using System; | ||||||||||||||
| using System.Collections.Generic; | ||||||||||||||
| using System.Diagnostics; | ||||||||||||||
| using System.Reflection; | ||||||||||||||
| using System.Reflection.Emit; | ||||||||||||||
| using System.Runtime.Serialization; | ||||||||||||||
| using System.Threading.Tasks; | ||||||||||||||
| using DurableTask.Core.Exceptions; | ||||||||||||||
|
|
@@ -541,5 +543,37 @@ protected CustomException(SerializationInfo info, StreamingContext context) | |||||||||||||
| { | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| [TestMethod] | ||||||||||||||
| public void IsCausedBy_DoesNotThrow_WhenMultipleAssembliesDefineSameType() | ||||||||||||||
| { | ||||||||||||||
| // Create two dynamic assemblies, each containing an Exception-derived type with the | ||||||||||||||
| // same fully qualified name. This simulates the scenario where the same exception type | ||||||||||||||
| // is loaded from multiple assemblies (e.g. different NuGet package versions). | ||||||||||||||
| string typeName = "TestDynamic.DuplicateException"; | ||||||||||||||
| CreateDynamicAssemblyWithExceptionType(typeName, "DynAssembly1"); | ||||||||||||||
| CreateDynamicAssemblyWithExceptionType(typeName, "DynAssembly2"); | ||||||||||||||
|
|
||||||||||||||
| // Create a FailureDetails whose ErrorType won't be resolved by Type.GetType(), | ||||||||||||||
| // typeof(T).Assembly, or the calling assembly, forcing the AppDomain fallback path. | ||||||||||||||
| var details = new FailureDetails( | ||||||||||||||
| typeName, "Test error", stackTrace: null, innerFailure: null, isNonRetriable: false); | ||||||||||||||
|
|
||||||||||||||
| // The old implementation would either throw AmbiguousMatchException or return false | ||||||||||||||
| // when multiple assemblies contained the same type. The fix uses Any() so this should | ||||||||||||||
| // succeed without throwing. | ||||||||||||||
|
Comment on lines
+562
to
+564
|
||||||||||||||
| // The old implementation would either throw AmbiguousMatchException or return false | |
| // when multiple assemblies contained the same type. The fix uses Any() so this should | |
| // succeed without throwing. | |
| // In this AppDomain fallback path, the old implementation would always throw | |
| // AmbiguousMatchException when more than one matching type was found. The fix uses | |
| // Any() so this should succeed without throwing. |
Uh oh!
There was an error while loading. Please reload this page.