11using System.Threading;
12using System.Reflection;
13using System.Runtime.InteropServices;
14using System.Runtime.CompilerServices;
18using System.Runtime.Serialization;
19using System.Diagnostics;
35 internal IntPtr hdl = IntPtr.Zero ;
36 internal IntPtr mkrt = IntPtr.Zero ;
41 [CallerMemberName]
string callfunc =
null,
42 [CallerLineNumber]
int callline = -1
45 IntPtr err =
Mk.MkErr(expobj);
46 IntPtr rt =
Mk.MkRuntimeGetFromObj(err);
47 hdl = err != IntPtr.Zero && err != def ? err :
Mk.MkErrorDup(rt,def);
51 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
52 Mk.MkErrorReset(rt,def,callfunc_cstr,callline,
false);
53 Marshal.FreeHGlobal(callfunc_cstr);
56 public MkExceptionC(SerializationInfo info, StreamingContext sctx) {
57 hdl = (IntPtr) info.GetValue(
"hdl", typeof(IntPtr));
61 Mk.MkRefDecr(mkrt,hdl);
65 public override void GetObjectData(SerializationInfo info, StreamingContext sctx) {
66 info.AddValue(
"hdl", hdl);
67 base.GetObjectData (info, sctx);
81 if (exception is TargetInvocationException) exception = exception.InnerException;
85 Mk.MkErrorSetE (mkrt,err, mqex.hdl);
88 IntPtr message_cstr = Marshal.StringToHGlobalAnsi($
"{exception.GetType().FullName}: {exception.Message}");
89 Mk.MkErrorSetC (mkrt,err, message_cstr, callfunc, -1);
90 Marshal.FreeHGlobal(message_cstr);
91 var st =
new System.Diagnostics.StackTrace(exception,
true);
93 foreach (var sf
in st.GetFrames()) {
94 if (!StackFrameExtensions.HasMethod(sf))
continue;
96 var meth = sf.GetMethod();
99 if (StackFrameExtensions.HasSource(sf)) {
100 fn = sf.GetFileName();
101 ln = sf.GetFileLineNumber();
103 fn = meth.DeclaringType.Module.Name;
107 if (meth.Name ==
"ServiceCall")
break;
126 base(
"NULL ERROR: the constructor '" + text +
"' got a NULL pointer") {
134 base(
"NULL REFERENCE ERROR: the argument '" + text +
"' got a NULL pointer") {
142 base(
"'" + text +
"' constructor return 'NULL' pointer") {
150 base(
"'" + text +
"' soft constructor return 'NULL' pointer") {
157 base(
"unable to find callback '" + cbS +
"' in class '" + cls.Name +
"' provide delegate '" + dlg +
"'") {
MkCallbackNotFoundError(Type cls, string dlg, String cbS)
MkConstructorNullExceptionC(string text="")
MkErrorC - the class known as err or error is used to create and manage an error message …
static MkErrorE Stack(IntPtr mkrt, IntPtr hdl, [CallerMemberName]string callfunc=null, [CallerFilePath]string callfile=null, [CallerLineNumber]int callline=-1)
C#: MkErrorE err.Stack([CallerMemberName]string callfunc = null, [CallerFilePath]string callfile = n...
static MkErrorE StackFull(IntPtr mkrt, IntPtr hdl)
C#: MkErrorE err.Stack([CallerMemberName]string callfunc = null, [CallerFilePath]string callfile = n...
C-API: MkExceptionC_C_API - MkExceptionC - The default-exception of the Programming-Language-Micro-...
MkExceptionC(IntPtr expobj, [CallerMemberName] string callfunc=null, [CallerLineNumber] int callline=-1)
convert an MkErrorC into a Target-Programming-Language (TPL) exception …
static IntPtr Catch(IntPtr mkrt, IntPtr expobj, Exception exception, IntPtr callfunc)
convert an Target-Programming-Language (TPL) exception into an MkErrorC …
MkExceptionC(SerializationInfo info, StreamingContext sctx)
override void GetObjectData(SerializationInfo info, StreamingContext sctx)
MkInitError(string text="")
MkInitSoftError(string text="")
MkReferenceNullExceptionC(string text="")
MkSignatureExceptionC(string text="")
static IntPtr MkErrorFORMAT(IntPtr fmtobj)
MK_STRN MkErrorGetText(MK_ERRN const err)
get the MkErrorS::text …
MK_ERR MkErrorFORMAT(MK_OBJN fmtobj)
system-error-format - format and return the default-error …