ConcurrentDictionary in MonoTouch - xamarin.ios

I am trying to use ConcurrentDictionary in my monotouch app. Everything runs OK in the I am trying to use ConcurrentDictionary in my monotouch app. Everything runs OK in the simulator however when I run in an iPad I get the following exception when creating an instance of the class which uses it. Any thoughts?
System.ExecutionEngineException: Attempting to JIT compile method 'System.Collections.Concurrent.SplitOrderedList`2<string, System.Collections.Generic.KeyValuePair`2<string, object>>:.ctor (System.Collections.Generic.IEqualityComparer`1<string>)' while running with --aot-only.
at System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Object]..ctor (IEqualityComparer`1 comparer) [0x00000] in <filename unknown>:0
at System.Collections.Concurrent.ConcurrentDictionary`2[System.String,System.Object]..ctor () [0x00000] in <filename unknown>:0

This is a known issue because of how, internally, the class is using generics. You can add yourself to the bug c.c. to get notified of updates / resolution.

Related

how to use unity and websockets

Hey guys I'm making a unity webGL build with websocketsharp, https://github.com/sta/websocket-sharp
Weird thing is it works fine when I run it from client, I can send and receive messages with nodeJS but when I upload the build to my server I get this error when I try to connect to the server
12/5/2021 6:53:40 PM|Fatal|.|System.Net.Sockets.SocketException (0x80004005): Could not resolve host 'mydomain.io'
Desktop.loader.js:1 at System.Net.Dns.Error_11001 (System.String hostName) [0x00000] in <00000000000000000000000000000000>:0
here is how I am connecting in C#
ws = new WebSocket("wss://mydomain.io:8000");
ws.SetProxy("https://mydomain.io/server", "", "");
I have no idea how to debug this. Why would it work in the unity editor but not when I upload to the server? Is websocketssharp the best way to communicate with a nodeJS server?
As far as I understand in general WebSocket and networking .Net / c# classes are not supported in WebGL. You would need to either do the networking on JavaScript side or use UnityWebRequest.
In particular from the linked asset you are using
It works with Unity Free, but there are some limitations:
Security Sandbox of the Webplayer (The server is not available in Web Player)
WebGL Networking (Not available in WebGL)
Why would it work in the unity editor but not when I upload to the server?
-> Because within the Unity Editor you are still executing the pre-compiled .Net code on your standalone PC where these classes are fully supported. It isn't compiled into WebGL until you actually build your project.

Why does MathNet.Numerics.Control.UseManaged require Cuda?

I'm trying to test an ASP API controller which in turn calls out to a DLL which uses MathNet.Numerics.LinearAlgebra. I first call
MathNet.Numerics.Control.UseManaged();
However this call fails with the error
Exception thrown: 'System.NotSupportedException' in
MathNet.Numerics.dll
Additional information: Cuda Native Provider not found.
Why would Cuda be required when I'm explicitly telling MathNet to use managed not native?
It actually does not fail, the exception is handled internally. You can just continue debugging.
The exception is not actually thrown within the UseManaged call but internally at the static construction of the Control class, the first time it is being accessed and initializes the default providers (which includes probing whether any of the known native providers are available). Of course, Cuda is not required when using the managed providers.
This is indeed a small usability issue when debugging with "break on all exceptions" enabled. We may be able to avoid throwing the exception with a small refactoring. Maybe we should open a GitHub issue to track this?

Could not load type when using servicestack and AppDynamics monitor

When having the AppDynamics performance monitor installed, the servicestack API fails to load with the following exception:
Could not load type 'd__38' from assembly '###, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
StackTrace:
at ###.BaseService1.<Any>d__38.MoveNext() in ###\Services\BaseService.cs:line 190
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine& stateMachine)
at ###.BaseService1.Any(T request)
at ServiceStack.Host.ServiceRunner1.Execute(IRequest request, Object instance, TRequest requestDto)
Any help is greatly appreciated.
Thank you
For whom it might be of interest I have found a workaround and more details about this issue. This occurs only in the following scenario:
AppDynamics agent is installed and running
ServiceStack API is compiled using the MSBuild from c:\Windows\Microsoft.NET\Framework64\v4.0.30319\MsBuild.exe
If you use the MsBuild 14 that is installed along Microsoft Visual Studio 2015 RC then this issue does not occur anymore. From my first findings there is an issue in ServiceStack's way of caching the endpoints and wrapping the execute method using Linq but I don't understand why this happens only when AppDynamics agent is installed.
#mythz if you want to dig deeper into this issue I'm available to help but with the above solution everything is ok.
Hope this helps
Love to help you out here, but there are no details about the error, please email help#appdynamics.com for assistance. I assume this is C#, but wouldn't know based on this. AppDynamics supports many languages and technologies.

System.TypeLoadException: A type load exception has occurred

While trying to test out Apigee for our app, I ran into the error "System.TypeLoadException: A type load exception has occurred." I think that it is caused by one of two things which the output showed;
Loaded assembly: /Users/magnimbusllc/Library/Caches/Xamarin/mtbs/builds/ApigeeTestApp/69798d35-5a45-4499-9fcb-2029fc7d533c/assemblies/Newtonsoft.Json.dll
2014-01-15 12:09:12.391 ApigeeTestApp[65077:a0b] Could not load 'Newtonsoft.Json' for registration: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/Assembly.cs:351
at MonoTouch.Registrar.OldDynamicRegistrar.RegisterAssembly (System.Reflection.Assembly a) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/OldDynamicRegistrar.cs:67
objc[65077]: Class AXEmojiUtilities is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/PrivateFrameworks/AccessibilityUtilities.framework/AccessibilityUtilities and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/usr/lib/libAXSpeechManager.dylib. One of the two will be used. Which one is undefined.
I have a PasteBin with the full output from building. I just don't know if I should rebuild the Apigee Library using a different Newtonsoft library or if it is something else (don't fully understand the error).
I am building an iOS app using Xamarin, the machines I am using are a Windows 8 machine for development, and a Mac Mini for building.
As this looks to be a .NET application, you might want to try to unload the dependency (Newtonsoft.Json.dll) and re-add it in Visual Studio.
Another approach is to compile NewtonSoft yourself, as it is open-source.

Exception thrown in very specific configuration

I have very weird situation where I have unit test (XUnit) that try to resolve webapi controllers through Autofac ( with web api contrib).
I have a situation where If I switch my configuration in Release mode, test in x86 mode, and run my test (if debug my test then it works) it throws an exception about the fact it can't resolve the controller.
Change whatever parameters in the above configuration it then works perfectly(I am using VS2012).
I know it is very little information and can not ask for a solution, but any clue about what could have been wrong will be appreciated!
Just for the record , I was trying to look at the stack frame to extract the caller class of method. In release mode, JIT may actually optimize the call stack (kind of Tail optimization) and basically remove what I expected to find (and was able to find in debug).

Resources