Bug 43015 - Enum.IsDefined crashes with NSUrlError
Summary: Enum.IsDefined crashes with NSUrlError
Status: RESOLVED NORESPONSE
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries ()
Version: XI 9.6 (iOS 9.3)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-08-02 21:05 UTC by Dimitar Dobrev
Modified: 2016-09-09 11:20 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED NORESPONSE

Description Dimitar Dobrev 2016-08-02 21:05:21 UTC
NSUrlError is an enum so Enum.IsDefined(typeof(NSUrlError), <any_int>) should return true or false. Instead, it crashes with System.InvalidOperationException "Unknown enum type.".

  at System.RuntimeType.IsEnumDefined (System.Object value) [0x000f4] in /Users/builder/data/lanes/3412/3cf8aaed/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/rttype.cs:4176 
  at System.Enum.IsDefined (System.Type enumType, System.Object value) [0x00017] in /Users/builder/data/lanes/3412/3cf8aaed/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/enum.cs:612

It's also strange that at the same time Enum.GetValues(typeof(NSUrlError)) works properly.
Comment 1 Manuel de la Peña [MSFT] 2016-08-04 09:03:12 UTC
Hi, 

I have done a small test and I did not get a InvalidOperationException. Can you please provide more information of your runtime. 

The easiest way to get exact version information is to use the 
"Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" 
button and copy/paste the version informations (you can use the 
"Copy Information" button).

My system (provided bellow) has no issues with the Enum check:

=== Xamarin Studio Business ===

Version 6.1 (build 4373)
Installation UUID: 01060673-5bee-4cf4-a4c2-5e36a18d39a2
Runtime:
	Mono 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404020011

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.1.2.21 (Xamarin Business)
Android SDK: /Users/mandel/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		6.0   (API level 23)

SDK Tools Version: 25.1.6
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.3 (10183.3)
Build 7D175

=== Xamarin.Mac ===

Version: 2.8.2.22 (Xamarin Business)

=== Xamarin.iOS ===

Version: 9.8.2.22 (Xamarin Business)
Hash: f37444a
Branch: cycle7-sr1
Build date: 2016-07-28 12:17:02-0400

=== Build Information ===

Release ID: 601004373
Git revision: 852a87304bbbd9c26e81bbb2428dafc6145f1601
Build date: 2016-05-31 01:09:06-04
Xamarin addins: d6b49aee9d3b2f75a1eea84b8ad3b2d1d4fd77c0
Build lane: monodevelop-lion-master

=== Operating System ===

Mac OS X 10.11.6
Darwin Mandels-Pro-Work.local 15.6.0 Darwin Kernel Version 15.6.0
    Thu Jun 23 18:25:34 PDT 2016
    root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Addin Maker 1.3.2
StyleCop Support 1.0.1.9
Manifest.addin 0.0.0.0
Comment 2 Vincent Dondain [MSFT] 2016-09-09 11:20:38 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report.
Thanks!