Bug 44582 - Generator needs support for enums with different values in 32 and 64-bit
Summary: Generator needs support for enums with different values in 32 and 64-bit
Status: CONFIRMED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Other ()
Version: Master
Hardware: PC Mac OS
: High normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-09-21 15:44 UTC by Chris Hamons
Modified: 2017-02-24 19:48 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 for Bug 44582 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Chris Hamons 2016-09-21 15:44:27 UTC
This PR pointed out that Apple now has enums with different values in 32-bit and 64-bit

https://github.com/xamarin/xamarin-macios/pull/853#discussion_r79636404


Unchecked code should be fine for unsigned values, but not for signed:

csharp> unchecked ((uint) ulong.MaxValue == uint.MaxValue);
true
csharp> unchecked ((int) long.MaxValue == int.MaxValue);    
false


we already have some code for return values: https://github.com/xamarin/xamarin-macios/blob/master/src/generator.cs#L3879-L3887
Comment 1 Rolf Bjarne Kvinge [MSFT] 2016-12-06 17:35:24 UTC
Better link for return values: https://github.com/xamarin/xamarin-macios/blob/39d903ab663282d30668dd1d1d16329803116b71/src/generator.cs#L3835-L3848
Comment 2 Sebastien Pouliot 2017-02-24 19:48:40 UTC
> we should detect them first (xtro?) and see how to expose them correctly

https://trello.com/c/p27XBSOm/660-different-32-64-bit-enum-values#comment-58988d1be51ca9edbdd1f010

Honestly I'm not sure how to handle them yet - but we need to know them first.

If there's only a few we could add some helper (extension ?) methods like:

> value.IsUnknown ()

that will check an integer (int or long) value depending if run on 32 or 64 bits OS.