SharingSettings is null in every new instances of ProvisioningTenant
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Hi,
I just bumped into this when trying to implement a Handler-filter kind of rule, in which I look into the strongly-typed ProvisioningTemplate object for each Handler related property, and decide whether or not the associated Handler should be passed to ApplyProvisioningTemplate(ProvisioningTemplate, ProvisioningTemplateApplyingInformation).
ie. for Files or ContentTypes, I safely check if the collection contains any element. For Header or Footer, I check if they are null, etc. But for some properties (the ones implementing IEquatable<>) I rely on the fact that they are equals (or not) to their default instance equivalent.
Basically, is it true that myTemplate.Tenant.Equals(new ProvisioningTenant()) ?
It works like a charm for every properties in the template but the Tenant one, because in a new instance of the ProvisioningTenant class, the SharingSettings property is not initialized (unlike others), and then calls to .GetHashCode() or .Equals() just throw a NullReferenceException.
Would it be a good choice to initialize a new SharingSettings() in the property getter ? If yes may I send a pull request to this repository ?
Many thanks !
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ProvisioningTenant and SharingSettings implementations, focusing on the SharingSettings property and the Equals/GetHashCode paths mentioned in the report. Reproduce comparisons against a new ProvisioningTenant and verify that those operations no longer throw a NullReferenceException when the property has not been explicitly set.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100