Occasionally the following line throws a System.OverflowException:
var request = new RestRequest("", Method.GET, DataFormat.Json);
This is running on a Raspbian OS using the Mono Runtime.
The Exception never happened on Windows where the application was developed.
Full Stacktrace:
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'RestSharp.RestRequest' threw an exception. --->
System.TypeInitializationException: The type initializer for 'System.Text.RegularExpressions.Regex' threw an exception. --->
System.OverflowException: TimeSpan overflowed because the duration is too long.
at System.TimeSpan.Interval (System.Double value, System.Int32 scale) <0xb4a01520 + 0x0010c> in <d0a5e45894084fd7b6ea7e0fe6ac414c>:0
at System.TimeSpan.FromMilliseconds (System.Double value) <0xb4a0165c + 0x0001b> in <d0a5e45894084fd7b6ea7e0fe6ac414c>:0
at System.Text.RegularExpressions.Regex..cctor () [0x0001c] in <c0e40d34c25e4827874530676d4126b9>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
at RestSharp.RestRequest..cctor () [0x00000] in <bc58aa49caeb486c80c16d44db0069c3>:0
Related
I have a stacktrace in my program which contains
at mynamespace.MyClass+B.A()
I want to understand what the + symbol after the class name means.
Below, the trace detail:
01-01 06:58:35.578 8189 8216 E mono : Unhandled Exception
01-01 06:58:35.578 8189 8216 E mono : System.NullReferenceException: Object reference not set to an instance of an object
01-01 06:58:35.578 8189 8216 E mono : at FTA1769_Bootloader.Classes.FTAStartupStateMachine+B.A () [0x000de] in <32f83d28d4ae43cc80a2c093d1253500>:0
01-01 06:58:35.578 8189 8216 E mono : --- End of stack trace from previous location where exception was thrown ---
01-01 06:58:35.578 8189 8216 E mono : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <a5d9585e686a4a1bbce8735d2cf30fa7>:0
01-01 06:58:35.578 8189 8216 E mono : at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_1 (System.Object state) [0x00000] in <a5d9585e686a4a1bbce8735d2cf30fa7>:0
01-01 06:58:35.578 8189 8216 E mono : at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <a5d9585e686a4a1bbce8735d2cf30fa7>:0
...
The thing is that my class does not have any declared inner classes. It does have an inner enum declared. Could that be it? (the code is obfuscated and it is hard for me to identify the elements)
We use mono 4.8.0 for our product. When running particular testings on different kinds of Linux, we got unhandled exception triggered occasionally. More specifically AppDomain.UnhandledException event triggered. But we can't figure out which line of our code triggered the exception. I'm wondering is this a defect of mono?
[ERROR] FATAL UNHANDLED EXCEPTION: System.ExecutionEngineException: ExecutionContext_ExceptionInAsyncLocalNotification ---> System.Threading.ThreadAbortException
at System.Collections.Generic.ObjectEqualityComparer'1[T].Equals (T x, T y) <0x7f0f20aa1e80 + 0x00000> in :0
at System.Collections.Generic.Dictionary'2[TKey,TValue].FindEntry (TKey key) [0x0005d] in :0
at System.Collections.Generic.Dictionary'2[TKey,TValue].TryGetValue (TKey key, TValue& value) [0x00000] in :0
at System.Threading.ExecutionContext.OnAsyncLocalContextChanged (System.Threading.ExecutionContext previous, System.Threading.ExecutionContext current) [0x00119] in ...../mono/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:749
--- End of inner exception stack trace ---
at System.Environment.FailFast (System.String message, System.Exception exception) [0x00000] in ...../mono/mono/mcs/class/corlib/System/Environment.cs:929
at System.Threading.ExecutionContext.OnAsyncLocalContextChanged (System.Threading.ExecutionContext previous, System.Threading.ExecutionContext current) [0x00164] in ..../mono/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:758
at System.Threading.ExecutionContext.SetExecutionContext (System.Threading.ExecutionContext executionContext, System.Boolean preserveSyncCtx) [0x0005f] in ..../mono/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:1028
Thanks
Try <AppContextSwitchOverrides value="Switch.System.Globalization.NoAsyncCurrentCulture=true" /> and avoid using AsyncLocal<T>
I am trying to compile a C# Hello World application in Rider on Linux.
When I try to run the app, I am promted the following exception:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.Exception: Magic number is wrong: 542
at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32& position) [0x00028] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.TermInfoDriver..ctor (System.String term) [0x00055] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.ConsoleDriver..cctor () [0x0004d] in <a84b655e5e6a49ee96b338ec792f5580>:0
--- End of inner exception stack trace ---
at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.Console..cctor () [0x0008e] in <a84b655e5e6a49ee96b338ec792f5580>:0
--- End of inner exception stack trace ---
at TestCaseApp.Program.Main (System.String[] args) [0x00001] in <662667bfa1e4443ea031df076247d2d3>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.Exception: Magic number is wrong: 542
at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32& position) [0x00028] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.TermInfoDriver..ctor (System.String term) [0x00055] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.ConsoleDriver..cctor () [0x0004d] in <a84b655e5e6a49ee96b338ec792f5580>:0
--- End of inner exception stack trace ---
at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.Console..cctor () [0x0008e] in <a84b655e5e6a49ee96b338ec792f5580>:0
--- End of inner exception stack trace ---
at TestCaseApp.Program.Main (System.String[] args) [0x00001] in <662667bfa1e4443ea031df076247d2d3>:0
I am using Antergos (Linux) and JetBrains Rider 2017.3.1
Build #RD-173.3994.2442
I have am using Mono 5.4.1.7-2
I did some research about this bug and I found:
https://github.com/mono/mono/issues/6752#issuecomment-365212655
Mono compiler // Terminal emulator issue
Everything mentioned in these threads didn't help me to fix this issue. What can I do?
Did you not follow the instructions on that page? You need to set your TERM environmental variable to xterm as a fix:
export TERM=xterm
Then verify it is changed with:
echo $TERM
The means exactly this: "I want to run your script, but you need to specify the terminal you want me to use"
In GoG version of Stardew Valley, the script in question is: ./start.sh
Launching this causes the above error.
If instead:
export 'TERM=roxterm' && ./start.sh
then it works because I have the roxterm terminal installed on my system and the script can use it to execute. What I do know is the global parameter in Ubuntu that tells scrips use this unless it is: Default Applications
Looking at snippet of the script, originally it is:
run_game() {
echo "Running ${GAME_NAME}"
cd game
chmod +x *
./"StardewValley"
}
Corrected for roxterm it would be:
run_game() {
echo "Running ${GAME_NAME}"
cd game
chmod +x *
export 'TERM=roxterm' && ./"StardewValley"
}
The latter solution works with application launchers and is thus superior.
I get this error when I try to compile csharp or fsharp files. This happens when using gnome terminal or jetbrain rider.
It works fine in tty or termials like xterm and urxvt.
Also I am able to compile c, c++ and go code.
Btw, I am using Arch/Antergos and got this issue yesterday.
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.Exception: Magic number is wrong: 542
at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32& position) [0x00028] in :0
at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in :0
at System.TermInfoDriver..ctor (System.String term) [0x00055] in :0
at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in :0
at System.ConsoleDriver..cctor () [0x0004d] in :0
--- End of inner exception stack trace ---
at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in :0
at System.Console..cctor () [0x0008e] in :0
--- End of inner exception stack trace ---
at Mono.CSharp.Driver.Main (System.String[] args) [0x00019] in <2b1e99ce45b54209bdcdab138d9758ae>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.Exception: Magic number is wrong: 542
at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32& position) [0x00028] in :0
at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in :0
at System.TermInfoDriver..ctor (System.String term) [0x00055] in :0
at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in :0
at System.ConsoleDriver..cctor () [0x0004d] in :0
--- End of inner exception stack trace ---
at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in :0
at System.Console..cctor () [0x0008e] in :0
--- End of inner exception stack trace ---
at Mono.CSharp.Driver.Main (System.String[] args) [0x00019] in <2b1e99ce45b54209bdcdab138d9758ae>:0
we are programming an multiplatform program with mono.
now i want to use some native code on a mac.
I found the NSLocal class and wanted to use:
string test = NSLocale.CurrentLocale.CountryCode;
but i run into an exception when the program is hitting this code:
Message: An exception of Type System.ArgumentNullException occured.
Message was: Value cannot be null. Parameter name: obj
Stacktrace:
at (wrapper managed-to-native)
System.Object:__icall_wrapper_mono_monitor_enter_v4_internal
(object,intptr) at ObjCRuntime.Runtime.TryGetNSObject (System.IntPtr
ptr, System.Boolean evenInFinalizerQueue) [0x00009] in
<1a80b695c02b4e7dbda63e331ae0ac27>:0
other code like:
string[] test2 = NSLocale.ISOCountryCodes;
also runs into an exception:
Message: An exception of type System.TypeInitializationException
occured. Message was: The type initializer for 'Foundation.NSString'
threw an exception.
Stacktrace:
at Foundation.NSArray.StringArrayFromHandle (System.IntPtr handle)
[0x00047] in <1a80b695c02b4e7dbda63e331ae0ac27>:0 at
Foundation.NSLocale.get_ISOCountryCodes() [0x00010] in
<1a80b695c02b4e7dbda63e331ae0ac27>:0
well what i'am doing wrong? when i'm calling this native code?
Thanks