Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetricsFailures is non-nullable in C# #2573

Merged
merged 3 commits into from
Jul 26, 2024

Conversation

bernardnormier
Copy link
Member

Fixes #2567.

@bernardnormier bernardnormier requested review from pepone and externl July 25, 2024 17:47
@@ -182,9 +182,9 @@ internal IceMX.MetricsFailures getFailures()
{
if (_failures == null)
{
return null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was bogus. We no longer accept null for struct parameters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the generated type a record class and not a record struct?

public sealed partial record class MetricsFailures

Is this bogus, or did we change the default mapping for structs to record class?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not bogus. In C#, the default mapping for most Slice structs, including struct MetricsFailures, is a C# class. For Ice 3.8, it's a "record class" instead of a plain class.

@@ -880,7 +880,7 @@ override public IceMX.MetricsFailures[] getMapMetricsFailures(string viewName, s
{
return view.getFailures(mapName, id);
}
return new IceMX.MetricsFailures("", null); // null == dictionary
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was bogus too. We actually verify in the generated constructor the second parameter is non-null. This code appears untested.

@@ -182,9 +182,9 @@ internal IceMX.MetricsFailures getFailures()
{
if (_failures == null)
{
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the generated type a record class and not a record struct?

public sealed partial record class MetricsFailures

Is this bogus, or did we change the default mapping for structs to record class?

csharp/src/Ice/Internal/MetricsAdminI.cs Show resolved Hide resolved
@bernardnormier bernardnormier changed the title MetricsFailure is non-nullable in C# MetricsFailures is non-nullable in C# Jul 25, 2024
@bernardnormier bernardnormier merged commit 8570095 into zeroc-ice:main Jul 26, 2024
17 of 18 checks passed
@bernardnormier bernardnormier deleted the fix2567 branch December 9, 2024 17:08
InsertCreativityHere pushed a commit to InsertCreativityHere/compiler-comparison that referenced this pull request Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

csharp/Ice/metrics failure (CI, release ubuntu)
3 participants