Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemberTypes show as changed between site reboots. #142

Closed
KevinJump opened this issue Jul 15, 2020 · 9 comments · Fixed by #175
Closed

MemberTypes show as changed between site reboots. #142

KevinJump opened this issue Jul 15, 2020 · 9 comments · Fixed by #175
Assignees
Labels
bug Something isn't working release/8.6.4 8.6.4 - Patch release. release/8.7.2

Comments

@KevinJump
Copy link
Owner

Reporting or importing member types between reboots of a site , will report changes to the member type because the internal guid values reported by umbraco change.

we should ignore the guid value for these pre-built properties on a member type.

@KevinJump KevinJump added bug Something isn't working release/8.6.4 8.6.4 - Patch release. labels Jul 15, 2020
@KevinJump KevinJump self-assigned this Jul 15, 2020
@creativesuspects
Copy link

creativesuspects commented Oct 7, 2020

@KevinJump I'm using uSync 8.7.1 and I'm doing some testing with two different environments connected to the same database. When I generate an export on environment A and move the export files to environment B and run the report it says that all the properties for the built in member type have changes.

Do you have any idea why that is? Or how I can prevent this?

image

@KevinJump
Copy link
Owner Author

Hi, can you perform an export on server b and compare the member type config file between the two?

I am guessing it's a guid thing but they should be the same because uSync makes a guid based on the alias.

@creativesuspects
Copy link

creativesuspects commented Oct 7, 2020

Sorry, I should've included the export files. And yes, the guid's are different.

Server A

<?xml version="1.0" encoding="utf-8"?>
<MemberType Key="d59be02f-1df9-4228-aa1e-01917d806cda" Alias="Member" Level="1">
  <Info>
    <Name>Member</Name>
    <Icon>icon-user</Icon>
    <Thumbnail>icon-user</Thumbnail>
    <Description></Description>
    <AllowAtRoot>False</AllowAtRoot>
    <IsListView>False</IsListView>
    <Variations>Nothing</Variations>
    <IsElement>false</IsElement>
    <Compositions />
  </Info>
  <GenericProperties>
    <GenericProperty>
      <Key>606834dc-0000-0000-0000-000000000000</Key>
      <Name>Is Approved</Name>
      <Alias>umbracoMemberApproved</Alias>
      <Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
      <Type>Umbraco.TrueFalse</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>2</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>92293765-0000-0000-0000-000000000000</Key>
      <Name>Comments</Name>
      <Alias>umbracoMemberComments</Alias>
      <Definition>c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3</Definition>
      <Type>Umbraco.TextArea</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>0</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>9130c1b7-0000-0000-0000-000000000000</Key>
      <Name>Failed Password Attempts</Name>
      <Alias>umbracoMemberFailedPasswordAttempts</Alias>
      <Definition>8e7f995c-bd81-4627-9932-c40e568ec788</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>1</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>f4a3a5bc-0000-0000-0000-000000000000</Key>
      <Name>Last Lockout Date</Name>
      <Alias>umbracoMemberLastLockoutDate</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>4</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>98b5c138-0000-0000-0000-000000000000</Key>
      <Name>Last Login Date</Name>
      <Alias>umbracoMemberLastLogin</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>5</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>73631232-0000-0000-0000-000000000000</Key>
      <Name>Last Password Change Date</Name>
      <Alias>umbracoMemberLastPasswordChangeDate</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>6</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>4709105d-0000-0000-0000-000000000000</Key>
      <Name>Is Locked Out</Name>
      <Alias>umbracoMemberLockedOut</Alias>
      <Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
      <Type>Umbraco.TrueFalse</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>3</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>b30aa568-0000-0000-0000-000000000000</Key>
      <Name>Password Answer</Name>
      <Alias>umbracoMemberPasswordRetrievalAnswer</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>8</SortOrder>
      <Tab></Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>1d44d6b2-0000-0000-0000-000000000000</Key>
      <Name>Password Question</Name>
      <Alias>umbracoMemberPasswordRetrievalQuestion</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>7</SortOrder>
      <Tab></Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
  </GenericProperties>
  <Structure />
  <Tabs>
    <Tab>
      <Caption>Membership</Caption>
      <SortOrder>1</SortOrder>
    </Tab>
  </Tabs>
</MemberType>

Server B

<?xml version="1.0" encoding="utf-8"?>
<MemberType Key="d59be02f-1df9-4228-aa1e-01917d806cda" Alias="Member" Level="1">
  <Info>
    <Name>Member</Name>
    <Icon>icon-user</Icon>
    <Thumbnail>icon-user</Thumbnail>
    <Description></Description>
    <AllowAtRoot>False</AllowAtRoot>
    <IsListView>False</IsListView>
    <Variations>Nothing</Variations>
    <IsElement>false</IsElement>
    <Compositions />
  </Info>
  <GenericProperties>
    <GenericProperty>
      <Key>e79dccfb-0000-0000-0000-000000000000</Key>
      <Name>Is Approved</Name>
      <Alias>umbracoMemberApproved</Alias>
      <Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
      <Type>Umbraco.TrueFalse</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>2</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>2a280588-0000-0000-0000-000000000000</Key>
      <Name>Comments</Name>
      <Alias>umbracoMemberComments</Alias>
      <Definition>c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3</Definition>
      <Type>Umbraco.TextArea</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>0</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>0f2ea539-0000-0000-0000-000000000000</Key>
      <Name>Failed Password Attempts</Name>
      <Alias>umbracoMemberFailedPasswordAttempts</Alias>
      <Definition>8e7f995c-bd81-4627-9932-c40e568ec788</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>1</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>3a7bc3c6-0000-0000-0000-000000000000</Key>
      <Name>Last Lockout Date</Name>
      <Alias>umbracoMemberLastLockoutDate</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>4</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>b5e309ba-0000-0000-0000-000000000000</Key>
      <Name>Last Login Date</Name>
      <Alias>umbracoMemberLastLogin</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>5</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>ded56d3f-0000-0000-0000-000000000000</Key>
      <Name>Last Password Change Date</Name>
      <Alias>umbracoMemberLastPasswordChangeDate</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>6</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>c36093d2-0000-0000-0000-000000000000</Key>
      <Name>Is Locked Out</Name>
      <Alias>umbracoMemberLockedOut</Alias>
      <Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
      <Type>Umbraco.TrueFalse</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>3</SortOrder>
      <Tab>Membership</Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>9700bd39-0000-0000-0000-000000000000</Key>
      <Name>Password Answer</Name>
      <Alias>umbracoMemberPasswordRetrievalAnswer</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>8</SortOrder>
      <Tab></Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
    <GenericProperty>
      <Key>e2d9286a-0000-0000-0000-000000000000</Key>
      <Name>Password Question</Name>
      <Alias>umbracoMemberPasswordRetrievalQuestion</Alias>
      <Definition>0e9794eb-f9b5-4f20-a788-93acd233a7e4</Definition>
      <Type>Umbraco.Label</Type>
      <Mandatory>false</Mandatory>
      <Validation></Validation>
      <Description><![CDATA[]]></Description>
      <SortOrder>7</SortOrder>
      <Tab></Tab>
      <CanEdit>false</CanEdit>
      <CanView>false</CanView>
      <IsSensitive>false</IsSensitive>
      <MandatoryMessage></MandatoryMessage>
      <ValidationRegExpMessage></ValidationRegExpMessage>
    </GenericProperty>
  </GenericProperties>
  <Structure />
  <Tabs>
    <Tab>
      <Caption>Membership</Caption>
      <SortOrder>1</SortOrder>
    </Tab>
  </Tabs>
</MemberType>

@KevinJump
Copy link
Owner Author

Today i learnt that GetHashCode() does not return the same thing on diffrent platforms / .net versions 😞

https://docs.microsoft.com/en-us/dotnet/api/system.object.gethashcode?redirectedfrom=MSDN&view=netcore-3.1#remarks

Furthermore, .NET does not guarantee the default implementation of the GetHashCode method, and the value this method returns may differ between .NET implementations, such as different versions of .NET Framework and .NET Core, and platforms, such as 32-bit and 64-bit platforms.

Guessing server a is 32-bit and b is 64-bit ? or something like that

looks we need to move to a platform independent hashing algorithm for this.

@creativesuspects
Copy link

Here’s someone who came up with a solution:

https://andrewlock.net/why-is-string-gethashcode-different-each-time-i-run-my-program-in-net-core/

See the bespoke GetDeterministicHashCode() method near the bottom of the article.

@KevinJump
Copy link
Owner Author

Thanks.

I am also toying with a hard coding them 🤯 to fix this one issue - if i put in the generated hashes for these well know properties into a dictionary I will only break 1/2 of the existing memberType configs files out there.

Just checking if we use GetHashCode anywhere else that goes beyond the installation (we use it a few times when building internal cache things for speed, and once for a fallback which would already mean the guid wouldn't match.).

KevinJump pushed a commit that referenced this issue Oct 8, 2020
@KevinJump
Copy link
Owner Author

KevinJump commented Oct 8, 2020

did a bit from box A and a bit from box B - we use 'well known' guids for the default member type and a deterministic hash for any other membertype setups.

bonus, we've also fixed the 'create/delete' issue in the report 1a0a3d1

@creativesuspects
Copy link

Looking forward to a new release. 😊

@KevinJump KevinJump linked a pull request Oct 13, 2020 that will close this issue
KevinJump added a commit that referenced this issue Oct 21, 2020
* Stop extra lookups of Root when content is missing.

* ISyncNodeSerializer, ISyncNodeTracker - speeding up import #171

* perf: improved parent path lookup

* Fix #142 - HashCode isn't deterministic

* Improve the tracker - so things that are matched on key then alias, don't show up as delete/create

* Update contentType tracker - track strutures by alias

* Change seperator for property path in tracker

* code cleanup (usings)

* add clear history button, make history load on tab view.

* Sync history events, to reload after import/export.

* Add key only serialization option #176

Adds a KeysOnly setting for the dictionary serializer

* Support for media in the grid styles.

Supports media inside the grid styles elements.

* Prerelease fix - path gets muddled when its in the cache

* prerelease fix: don't include root in friendly path.

* version bump. v8.7.2

* move version back to description

* Add option to ignore config by editorAlias or item name #178

* Generic IgnoreAlias setting for all handlers - stops them being imported completely.  #178

* up the version cache numbers for the js.

* Don't show addons if uSync.Complete is installed.

* Allow uSync folder to be set outside the site root #173

* Prerelease fix - Blueprint path fix.

* 8.7.2 version/readme.

Co-authored-by: Kevin Jump <[email protected]>
@creativesuspects
Copy link

Just tested the 8.7.2 release and the Member Types issue has been solved. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release/8.6.4 8.6.4 - Patch release. release/8.7.2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants