This is the project I could reproduce this bug with: https://developer.xamarin.com/samples/monotouch/InfColorPicker/
- Open InfColorPickerBinding.sln
- Go the the binding project project's options > Objective C Binding Build > Select "Process enums as bindings instead of external types".
You should get the following build error:
`obj/Debug/ios/InfColorPicker/InfComponentIndex.g.cs(38,14,38,31): error CS0101: The namespace 'InfColorPicker' already contains a definition for 'InfComponentIndex'`
Change `StructsAndEnums.cs` build action to: "ObjcBindingApiDefinition".
Environment used: https://gist.github.com/VincentDondain/2aac9232a19b989303317bf432449613
I can confirm this happens with latest xamarin-macios/master @ dce730ddb7bdf8d7c2d3d460b0f141ede125a84e
@Vincent please attach build logs whenever you're quoting from them.
This looks like a sample issue. By default the same enum can be put inside both "API definition" (because it won't be generated) and in the manual `StructsAndEnums.cs` file. Once compiled together you end up with a single (non generated) enum type.
Now if you enable enum processing then the enum from "API definition" will be generated and will collide with the same one from the manual file.
The proposed workaround might compile (in this case) but is likely not producing the same final API (missing all structs). In fact "one does not simply" enable --process-enums and expect identical output ;-) You need to update/move enums inside the bindings project.
The fix is to either:
1. Correct the sample (if there's some value to enabling enum processing on it) to work when processing enums;
2. Leave the sample as is, since it works with older versions of XI;
Oops indeed, forgot the build output: https://gist.github.com/VincentDondain/3734cd926fb17bb84a9d91387fb3229f
"Now if you enable enum processing then the enum from "API definition" will be generated and will collide with the same one from the manual file."
^ that would have been my assumption too however the enum isn't defined twice it's only defined once in `StructsAndEnums.cs`
I believe this was Alex's question too when I asked him but that's why he confirmed the bug.
Created attachment 21764 [details]
Project to repro