Skip to content

Commit cd29e55

Browse files
committed
debug: add exception logging for failing NativeAOT methods
1 parent 51d6bcc commit cd29e55

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

native/ThermoNativeReader/NativeApi.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,21 @@ public static int IsError()
973973
return _rawFile.IsError ? 1 : 0;
974974
}
975975

976+
[UnmanagedCallersOnly(EntryPoint = "get_sample_information")]
977+
public static IntPtr GetSampleInformation()
978+
{
979+
if (_rawFile == null) return IntPtr.Zero;
980+
try {
981+
var info = _rawFile.SampleInformation;
982+
if (info == null) return IntPtr.Zero;
983+
984+
return SerializeSampleInformation(info);
985+
} catch (Exception ex) {
986+
Console.WriteLine("Exception in GetSampleInformation: " + ex.ToString());
987+
return IntPtr.Zero;
988+
}
989+
}
990+
976991
[UnmanagedCallersOnly(EntryPoint = "in_acquisition")]
977992
public static int InAcquisition()
978993
{
@@ -1518,7 +1533,10 @@ public static int GetInstrumentMethodCount()
15181533
if (_rawFile == null) return 0;
15191534
try {
15201535
return _rawFile.InstrumentMethodsCount;
1521-
} catch { return 0; }
1536+
} catch (Exception ex) {
1537+
Console.WriteLine("Exception in InstrumentMethodsCount: " + ex.ToString());
1538+
return 0;
1539+
}
15221540
}
15231541

15241542
[UnmanagedCallersOnly(EntryPoint = "get_instrument_method")]

0 commit comments

Comments
 (0)