Describe the bug
After upgrading from 0.35.0-preview to 4.6.0-preview, trying to remove an Extension Property from a Group (by setting it to null) fails with System.NullReferenceException.
To Reproduce
Steps to reproduce the behavior:
The GraphBeta alias below is to allow usage of both Beta and 1.0 Graph endpoints by using the regular and the preview SDKs in the project.
graphServiceClient is a valid GraphServiceClient object
appId is the registered AAD application ID
directoryObjectId is the AD Group GUID
var internalExtensionName = $"extension_{appId.Replace("-", string.Empty)}_{entensionName}";
var objectoToUpdate = new GraphBeta.Group { Id = directoryObjectId, AdditionalData = new Dictionary<string, object>() };
objectoToUpdate.AdditionalData.Add(internalExtensionName, null);
await graphServiceClient.Groups[directoryObjectId].Request().UpdateAsync(objectoToUpdate);
Expected behavior
After setting the extension property to null it should be removed from the Group object.
Please note:
Adding an extension property still works in 4.6.0-preview SDK.
Adding and removing an extension property works fine on 0.35.0-preview SDK.
Client version
Microsoft.Graph.Beta 4.6.0-preview
Desktop (please complete the following information):
OS: Windows 10
Browser N/A
Version N/A
Additional context
ShouldSetAndRemoveExtensionProperty
Source: GraphTests.cs line 326
Duration: 2.7 min
Message:
Test method Shared.Graph.Test.GraphTests.ShouldSetAndRemoveExtensionProperty threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.
Describe the bug After upgrading from 0.35.0-preview to 4.6.0-preview, trying to remove an Extension Property from a Group (by setting it to null) fails with System.NullReferenceException.
To Reproduce Steps to reproduce the behavior:
The GraphBeta alias below is to allow usage of both Beta and 1.0 Graph endpoints by using the regular and the preview SDKs in the project.
graphServiceClient is a valid GraphServiceClient object appId is the registered AAD application ID directoryObjectId is the AD Group GUID
Expected behavior After setting the extension property to null it should be removed from the Group object.
Please note: Adding an extension property still works in 4.6.0-preview SDK. Adding and removing an extension property works fine on 0.35.0-preview SDK.
Client version Microsoft.Graph.Beta 4.6.0-preview
Desktop (please complete the following information):
Additional context
ShouldSetAndRemoveExtensionProperty Source: GraphTests.cs line 326 Duration: 2.7 min
Message: Test method Shared.Graph.Test.GraphTests.ShouldSetAndRemoveExtensionProperty threw exception: System.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace: Object.GetType() DerivedTypeConverter
1.Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) JsonConverter
1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) JsonConverter1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) JsonConverter
1.WriteCoreAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state) JsonSerializer.WriteCore[TValue](JsonConverter jsonConverter, Utf8JsonWriter writer, TValue& value, JsonSerializerOptions options, WriteStack& state) JsonSerializer.WriteCore[TValue](Utf8JsonWriter writer, TValue& value, Type inputType, JsonSerializerOptions options) JsonSerializer.Serialize[TValue](TValue& value, Type inputType, JsonSerializerOptions options) JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options) Serializer.SerializeObject(Object serializeableObject) BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) GroupRequest.UpdateAsync(Group groupToUpdate, CancellationToken cancellationToken) GraphClientQueryHelperExtensions.RemoveExtensionProperty(GraphServiceClient graphServiceClient, DirectoryObjectType directoryObjectType, String directoryObjectId, String appId, String extensionName) line 160 GraphTests.ShouldSetAndRemoveExtensionProperty() line 370 ThreadOperations.ExecuteWithAbortSafety(Action action)Standard Output: Debug Trace: GetIConfigurationRoot() Loading: Settings\Settings.json Loading: Settings\Settings.local.json
AB#10448