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

Move version check earlier #6674

Merged
merged 5 commits into from
Jul 26, 2021
Merged

Move version check earlier #6674

merged 5 commits into from
Jul 26, 2021

Conversation

Forgind
Copy link
Member

@Forgind Forgind commented Jul 14, 2021

Fixes #6659

The version check was previously after having deserialized everything else. This doesn't make sense and can lead to errors. In this PR, I moved it up.

// For the latter case, internals may be unexpectedly null.
if (retVal == null || version != CurrentSerializationVersion)
{
log.LogMessageFromResources("General.CouldNotReadStateFileMessage", stateFile, log.FormatResourceString("General.IncompatibleStateFileType"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it continues to make sense for this to be a quiet message. But do we have a test in place that this is not the case for freshly-built-everything using the SDK cache?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not. If I remember correctly, we decided it would be too hard for some reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we at least get it added to the manual SDK tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that sounds like a good idea to me. @marcpopMSFT, agree? If so, I can write up some (very detailed) instructions on testing it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reach out to Richa with the scenario you want covered. The difficulty with fresh machine tests as you can only have one.

byte version = 0;
translator.Translate(ref version);
// If retVal is still null or the version is wrong, log a message not a warning. This could be a valid cache with the wrong version preventing correct deserialization.
// For the latter case, internals may be unexpectedly null.
if (retVal == null || version != CurrentSerializationVersion)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retval will always be null here, right?

Suggested change
if (retVal == null || version != CurrentSerializationVersion)
if (version != CurrentSerializationVersion)

// For the latter case, internals may be unexpectedly null.
if (retVal == null || version != CurrentSerializationVersion)
{
log.LogMessageFromResources("General.CouldNotReadStateFileMessage", stateFile, log.FormatResourceString("General.IncompatibleStateFileType"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we at least get it added to the manual SDK tests?

Comment on lines 83 to 84
// If retVal is still null or the version is wrong, log a message not a warning. This could be a valid cache with the wrong version preventing correct deserialization.
// For the latter case, internals may be unexpectedly null.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update comment

Copy link
Member

@benvillalobos benvillalobos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please reach out to Richa with the scenario you want covered. The difficulty with fresh machine tests as you can only have one.

What was the status on this? A manual SDK test was mentioned

@Forgind
Copy link
Member Author

Forgind commented Jul 20, 2021

LGTM

Please reach out to Richa with the scenario you want covered. The difficulty with fresh machine tests as you can only have one.

What was the status on this? A manual SDK test was mentioned

I still need to write instructions. Bit behind on that front.

@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Jul 23, 2021
@ladipro ladipro merged commit ef21d41 into dotnet:main Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RAR Cache should be versioned (TranslateDictionary)
5 participants