Skip to content

Conversation

@filzrev
Copy link
Contributor

@filzrev filzrev commented Dec 6, 2025

This PR intended to fix a part issue of #2815

What's changed in this PR
Add #nullable enable setting and fix nullable annotations.
And fix nullable errors.

Other changes
Remove nullable annotation from CharacteristicObject constructor's id parameter.
when null or "" is passed to CharacteristicObject constructor.
It skip setting IdCharacteristic. and Default is used when getting Id as fallback value.

false);

public static Characteristic<T> Create<TOwner, [DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T>(string memberName, Func<CharacteristicObject, T, T> resolver, T fallbackValue, bool ignoreOnApply)
public static Characteristic<T> Create<TOwner, [DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T>(string memberName, Func<CharacteristicObject, T?, T> resolver, T fallbackValue, bool ignoreOnApply)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It need to allow null because some characteristics expected to return null(e.g. RuntimeCharacteristic/EnvironmentVariablesCharacteristic)


if (result.Length == 0)
result = IdCharacteristic.FallbackValue;
result = IdCharacteristic.FallbackValue!;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IdCharacteristic specify Default as fallback value. so it must not be null.

@filzrev filzrev marked this pull request as ready for review December 6, 2025 10:50
public InfrastructureMode Infrastructure => InfrastructureCharacteristic[this];
public AccuracyMode Accuracy => AccuracyCharacteristic[this];
public MetaMode Meta => MetaCharacteristic[this];
public EnvironmentMode Environment => EnvironmentCharacteristic[this]!;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Following getter field are set by constructor and should not be null.

  • Environment
  • Run
  • Accuracy
  • Meta

@filzrev filzrev force-pushed the chore-enable-nullable-2 branch from f21f56d to d7ebe52 Compare December 7, 2025 01:08
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.

1 participant