This project has moved and is read-only. For the latest updates, please go here.

Source code, NullReferenceException in AzureCPSettings.aspx.cs

Aug 7, 2014 at 10:00 AM
Hey again.
I have downloaded, built and published the solution to my dev farm, but it bombs when I try to save a new Azure AD tenant using the configuration page.

In the method AddLdapConnection, the following code throws an exception:
          new AzureTenant
                TenantName = this.TxtTenantName.Text,
                TenantId = this.TxtTenantId.Text,
                ClientId = TxtClientId.Text,
                ClientSecret = this.TxtClientSecret.Text,
Debugging this code shows that the AzureTenants property is null.
I can't find a place in the code where this is set.

I suspect the reason is that there was no tenant stored in the database when initializing the PersistedObject the first time, and therefore it won't set the AzureTenants property.

Any thoughts?

Aug 7, 2014 at 12:32 PM
Edited Aug 7, 2014 at 12:33 PM
many thanks for sharing this.
Indeed, I didn't initialize the collection in the creation of the persisted object. I missed that because I used to create object in a separate console application during my tests...
I fixed it and updated the package. You can download it and update with this cmdlet:
Update-SPSolution -GACDeployment -Identity "AzureCP.wsp" -LiteralPath "C:\Data\Dev\AzureCP.wsp"
Please note that it will recycle application pools.
Marked as answer by Yvand on 8/8/2014 at 4:01 AM