Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Environment.ProcessorCount is probably hitting the default path for mono_cpu_count (i.e. return 1;) which was fine but since we now have multicore Android phones/tablets, components such as ParallelFx needs that value to be correct for best performances.
I'm afraid I don't quite follow; as per:
mono_cpu_count() first has a #ifdef for _SC_NPROCESSORS_ONLN:
count = sysconf (_SC_NPROCESSORS_ONLN);
if (count > 0)
There's no online NDK installation for me to point you to, but for my Android NDK r5b, platforms/android-4/arch-arm/usr/include/sys/sysconf.h does contain:
#define _SC_NPROCESSORS_ONLN 0x0061
Consequently, this _should_ already work, and in fact it does: If I run an app on the Motorola Xoom, System.Environment.ProcessorCount is 2.
Weird, this is occuring on my LG Optimus 2x phone which like the Motorola Xoom is Tegra 2-based. Maybe the sysconf stuff isn't compiled in my kernel flavor.
I'll wait on a 2.3 update (phone is currently on 2.2.2) and follow-up there.
Are you running a Debug or Release binary? :-)
The DebugRuntime package includes libmonosgen-2.0.so for both armeabi and armeabi-v7a, and the app I was testing was a debug app. (When multiple native libraries are present in a .apk, Android extracts the "best" library for the device, which would be armeabi-v7a on the Xoom.)
However, by default Release apps include the armeabi runtime, _not_ the armeabi-v7a runtime. (You can control this in Project Properties > Application tab > Supported architectures.)
Thus, if you're running a Release app and you haven't changed the Supported architectures field, you'll be running the armeabi (ARMv5) runtime, and ARMv5 doesn't support multiple processors; see also Bug #281.
You may want to adjust your project properties to either exclusively use armeabi-v7a or include both.