2016-09-28 18:46:14 +03:00
|
|
|
|
// Copyright 2016 Xamarin Inc.
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using Mono.Cecil;
|
|
|
|
|
using Mono.Tuner;
|
|
|
|
|
using Xamarin.Bundler;
|
|
|
|
|
|
2017-02-10 09:45:42 +03:00
|
|
|
|
using Xamarin.Tuner;
|
|
|
|
|
|
2020-08-27 16:43:22 +03:00
|
|
|
|
#if NET
|
|
|
|
|
using Mono.Linker;
|
|
|
|
|
using Mono.Linker.Steps;
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-09-28 18:46:14 +03:00
|
|
|
|
namespace Xamarin.Linker {
|
|
|
|
|
|
|
|
|
|
public abstract class ExceptionalSubStep : BaseSubStep {
|
|
|
|
|
|
2017-02-10 09:45:42 +03:00
|
|
|
|
protected DerivedLinkContext LinkContext {
|
|
|
|
|
get {
|
2020-08-27 16:43:22 +03:00
|
|
|
|
#if NET
|
[dotnet-linker] Add MarkNSObjects into the pipeline. (#9543)
A few compat fixes were necessary to make the code compile and run correctly.
Fixes this startup crash with the linkall test:
2020-08-27 18:15:09.648352+0200 link all[91128:1963430] *** Assertion failure in void _UIApplicationMainPreparations(int, char **, NSString *__strong, NSString *__strong)(), /Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3920.31.100/UIApplication.m:4765
2020-08-27 18:15:09.697128+0200 link all[91128:1963430]
Unhandled Exception:
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Unable to instantiate the UIApplication delegate instance. No class named AppDelegate is loaded.
Native stack trace:
0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff258b8c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4 UIKitCore 0x00007fff48c8baed UIApplicationMain + 1862
5 ??? 0x00000001087d2504 0x0 + 4437386500
6 ??? 0x00000001087d237b 0x0 + 4437386107
7 ??? 0x00000001087cef93 0x0 + 4437372819
8 ??? 0x00000001087cedcb 0x0 + 4437372363
9 ??? 0x00000001087ceec1 0x0 + 4437372609
10 libmonosgen-2.0.dylib 0x00000001081a2d7e mono_jit_runtime_invoke + 1911
11 libmonosgen-2.0.dylib 0x000000010832ee0a do_runtime_invoke + 80
12 libmonosgen-2.0.dylib 0x0000000108331fd0 do_exec_main_checked + 92
13 libmonosgen-2.0.dylib 0x00000001081f191e mono_jit_exec + 369
14 libxamarin-debug.dylib 0x000000010802badd xamarin_main + 2685
15 link all 0x0000000107f0cced main + 45
16 libdyld.dylib 0x00007fff51a231fd start + 1
at ObjCRuntime.Runtime.ThrowNSException(IntPtr ns_exception)
at ObjCRuntime.Runtime.throw_ns_exception(IntPtr exc)
at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15
--- End of stack trace from previous location ---
at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15 0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff258b8c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4 UIKitCore 0x00007fff48c8baed UIApplicationMain + 1862
5 ??? 0x00000001087d2504 0x0 + 4437386500
6 ??? 0x00000001087d237b 0x0 + 4437386107
7 ??? 0x00000001087cef93 0x0 + 4437372819
8 ??? 0x00000001087cedcb 0x0 + 4437372363
9 ??? 0x00000001087ceec1 0x0 + 4437372609
10 libmonosgen-2.0.dylib 0x00000001081a2d7e mono_jit_runtime_invoke + 1911
11 libmonosgen-2.0.dylib 0x000000010832ee0a do_runtime_invoke + 80
12 libmonosgen-2.0.dylib 0x0000000108331fd0 do_exec_main_checked + 92
13 libmonosgen-2.0.dylib 0x00000001081f191e mono_jit_exec + 369
14 libxamarin-debug.dylib 0x000000010802badd xamarin_main + 2685
15 link all 0x0000000107f0cced main + 45
16 libdyld.dylib 0x00007fff51a231fd start + 1
2020-08-27 18:15:09.698283+0200 link all[91128:1963430] Unhandled managed exception: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Unable to instantiate the UIApplication delegate instance. No class named AppDelegate is loaded.
Native stack trace:
0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff258b8c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4 UIKitCore 0x00007fff48c8baed UIApplicationMain + 1862
5 ??? 0x00000001087d2504 0x0 + 4437386500
6 ??? 0x00000001087d237b 0x0 + 4437386107
7 ??? 0x00000001087cef93 0x0 + 4437372819
8 ??? 0x00000001087cedcb 0x0 + 4437372363
9 ??? 0x00000001087ceec1 0x0 + 4437372609
10 libmonosgen-2.0.dylib 0x00000001081a2d7e mono_jit_runtime_invoke + 1911
11 libmonosgen-2.0.dylib 0x000000010832ee0a do_runtime_invoke + 80
12 libmonosgen-2.0.dylib 0x0000000108331fd0 do_exec_main_checked + 92
13 libmonosgen-2.0.dylib 0x00000001081f191e mono_jit_exec + 369
14 libxamarin-debug.dylib 0x000000010802badd xamarin_main + 2685
15 link all 0x0000000107f0cced main + 45
16 libdyld.dylib 0x00007fff51a231fd start + 1
(Foundation.MonoTouchException)
at ObjCRuntime.Runtime.ThrowNSException(IntPtr ns_exception)
at ObjCRuntime.Runtime.throw_ns_exception(IntPtr exc)
at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15
--- End of stack trace from previous location ---
at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15
=================================================================
Native Crash Reporting
=================================================================
Got a abrt while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
=================================================================
Native stacktrace:
=================================================================
0x108273f92 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
0x1082207bd - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
0x1082737e9 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
0x0 - Unknown
0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
0x10801979f - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_unhandled_exception_handler
0x1082e4980 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_invoke_unhandled_exception_hook
0x108220166 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
0x10821ea47 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
0x10826ea06 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
0x1086105b0 - Unknown
0x1080194fb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception
0x108019377 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception_gchandle
0x108019333 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_ftnptr_exception_handler
0x10821feeb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
0x10821ea47 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
0x10826ea06 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
0x1086105b0 - Unknown
0x1087d264b - Unknown
0x10869439b - Unknown
0x108016c07 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_throw_ns_exception
0x10801a1cb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : _ZL17exception_handlerP11NSException
0x7fff23e3d36d - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __handleUncaughtException
0x7fff50ba8c05 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL15_objc_terminatev
0x7fff4f9f6c87 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib : _ZSt11__terminatePFvvE
0x7fff4f9f940b - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib : __cxa_get_exception_ptr
0x7fff4f9f93d2 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib : _ZN10__cxxabiv1L22exception_cleanup_funcE19_Unwind_Reason_CodeP17_Unwind_Exception
0x7fff50ba8ad6 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL26_objc_exception_destructorPv
0x7fff23e3cc88 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : +[NSException raise:format:arguments:]
0x7fff258b8c9b - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
0x7fff48c8baed - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
0x1087d2504 - Unknown
0x1087d237b - Unknown
0x1087cef93 - Unknown
0x1087cedcb - Unknown
0x1087ceec1 - Unknown
0x1081a2d7e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
0x10832ee0a - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : do_runtime_invoke
0x108331fd0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : do_exec_main_checked
0x1081f191e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_jit_exec
0x10802badd - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_main
0x107f0cced - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/link all : main
0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
2020-08-31 09:38:11 +03:00
|
|
|
|
return Configuration.DerivedLinkContext;
|
2020-08-27 16:43:22 +03:00
|
|
|
|
#else
|
2017-02-10 09:45:42 +03:00
|
|
|
|
return (DerivedLinkContext) base.context;
|
2020-08-27 16:43:22 +03:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if NET
|
|
|
|
|
protected LinkContext context {
|
|
|
|
|
get { return Context; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected LinkerConfiguration Configuration {
|
|
|
|
|
get { return LinkerConfiguration.GetInstance (Context); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected Profile Profile {
|
|
|
|
|
get {
|
|
|
|
|
return Configuration.Profile;
|
2017-02-10 09:45:42 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-27 16:43:22 +03:00
|
|
|
|
#endif
|
2017-02-10 09:45:42 +03:00
|
|
|
|
|
2016-09-28 18:46:14 +03:00
|
|
|
|
public override sealed void ProcessAssembly (AssemblyDefinition assembly)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
Process (assembly);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw Fail (assembly, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override sealed void ProcessType (TypeDefinition type)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
Process (type);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw Fail (type, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override sealed void ProcessField (FieldDefinition field)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
Process (field);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw Fail (field, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override sealed void ProcessMethod (MethodDefinition method)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
Process (method);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw Fail (method, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override sealed void ProcessProperty (PropertyDefinition property)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
Process (property);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw Fail (property, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override sealed void ProcessEvent (EventDefinition @event)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
Process (@event);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw Fail (@event, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// state-aware versions to be subclassed
|
|
|
|
|
|
|
|
|
|
protected virtual void Process (AssemblyDefinition assembly)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void Process (TypeDefinition type)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void Process (FieldDefinition field)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void Process (MethodDefinition method)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void Process (PropertyDefinition property)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void Process (EventDefinition @event)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// failure overrides, with defaults
|
|
|
|
|
|
|
|
|
|
protected virtual Exception Fail (AssemblyDefinition assembly, Exception e)
|
|
|
|
|
{
|
|
|
|
|
var message = $"{Name} failed processing `{assembly?.FullName}`.";
|
|
|
|
|
return ErrorHelper.CreateError (ErrorCode, e, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual Exception Fail (TypeDefinition type, Exception e)
|
|
|
|
|
{
|
|
|
|
|
var message = $"{Name} failed processing {type?.FullName}.";
|
|
|
|
|
return ErrorHelper.CreateError (ErrorCode | 1, e, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual Exception Fail (FieldDefinition field, Exception e)
|
|
|
|
|
{
|
|
|
|
|
var message = $"{Name} failed processing `{field?.FullName}`.";
|
|
|
|
|
return ErrorHelper.CreateError (ErrorCode | 2, e, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual Exception Fail (MethodDefinition method, Exception e)
|
|
|
|
|
{
|
|
|
|
|
var message = $"{Name} failed processing `{method?.FullName}`.";
|
|
|
|
|
return ErrorHelper.CreateError (ErrorCode | 3, e, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual Exception Fail (PropertyDefinition property, Exception e)
|
|
|
|
|
{
|
|
|
|
|
var message = $"{Name} failed processing {property?.FullName}.";
|
|
|
|
|
return ErrorHelper.CreateError (ErrorCode | 4, e, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual Exception Fail (EventDefinition @event, Exception e)
|
|
|
|
|
{
|
|
|
|
|
var message = $"{Name} failed processing {@event?.FullName}.";
|
|
|
|
|
return ErrorHelper.CreateError (ErrorCode | 5, e, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// abstracts
|
|
|
|
|
|
|
|
|
|
protected abstract string Name { get; }
|
|
|
|
|
|
|
|
|
|
protected abstract int ErrorCode { get; }
|
|
|
|
|
}
|
|
|
|
|
}
|