CesiumGS / CesiumGS/cesium-unity
Reinterop: Nullable, non-struct fields are not correctly accessed using std::optional
- Dominant language
- C#
- Stars
- 535
- Forks
- 132
- Avg merge
- 6h 45m
- Merged PRs (30d)
- 1
Description
From https://github.com/CesiumGS/cesium-unity/pull/211#discussion_r1115973471:
> When I do a nullable non-struct field in a class (for example, I added public int? test2 to CesiumGeoreference, it's not generating code with std::optional, it's doing this instead:
>
> ```cpp
> public: ::DotNet::System::Nullable1<::std::int32_t> test2() const;
> public: void test2(const ::DotNet::System::Nullable1<::std::int32_t>& value) const;
> ```
>
> Is that intentional?
Contributor guide
Research direction
Start with the discussion in PR #211 and the interop code-generation path for nullable fields. Use the reported public int? test2 field on CesiumGeoreference as the example, and compare its generated declarations with the expected handling of nullable struct fields. Done means the intended representation and accessors for nullable non-struct fields are determined and the reported behavior is addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100