pnp / pnp/pnpframework

SharingSettings is null in every new instances of ProvisioningTenant

Open
#408 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.