Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Prep tests for CoreCLR/CoreRT [Serializable] cleanup #20035

Merged
merged 2 commits into from
May 23, 2017

Conversation

morganbr
Copy link

@morganbr morganbr commented May 20, 2017

Fixes tests that depend on types in System.Private.CoreLib being serializable that won't be [Serializable] soon in CoreCLR/CoreRT.

Part of https://github.com/dotnet/corefx/issues/19119

@morganbr morganbr added this to the 2.0.0 milestone May 20, 2017
@morganbr morganbr self-assigned this May 20, 2017
@morganbr
Copy link
Author

CC @dotnet/corert-contrib

public void Serialization()
{
const string message = "FATAL ERROR: The pizza could not be found.";
var ex = new MissingManifestResourceException(message);
Copy link
Member

Choose a reason for hiding this comment

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

Serializatoin works, right - through the base Exceptoin type. Which probably has all the fields anyway. It just does not deserialize to the expected derived type.

Copy link
Member

Choose a reason for hiding this comment

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

No. If type B derives from A and B isn't marked [Serializable], it doesn't matter whether A is; B can't be serialized with BinaryFormatter.

{
var ex = new COMException("E_BAD_PIZZA", -1337);
BinaryFormatterHelpers.AssertRoundtrips(ex);
}
Copy link
Member

Choose a reason for hiding this comment

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

Delete the whole file.

Copy link
Author

Choose a reason for hiding this comment

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

Done

{
var ex = new InvalidComObjectException("E_BAD_PIZZA");
BinaryFormatterHelpers.AssertRoundtrips(ex);
}
Copy link
Member

Choose a reason for hiding this comment

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

Delete the whole file

Copy link
Author

Choose a reason for hiding this comment

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

Done

{
var ex = new InvalidOleVariantTypeException("E_BAD_PIZZA");
BinaryFormatterHelpers.AssertRoundtrips(ex);
}
Copy link
Member

Choose a reason for hiding this comment

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

Delete the whole file

Copy link
Author

Choose a reason for hiding this comment

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

Done

{
var ex = new MarshalDirectiveException("E_BAD_PIZZA");
BinaryFormatterHelpers.AssertRoundtrips(ex);
}
Copy link
Member

Choose a reason for hiding this comment

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

Delete the whole file

Copy link
Author

Choose a reason for hiding this comment

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

Done

{
var ex = new SEHException("E_BAD_PIZZA");
BinaryFormatterHelpers.AssertRoundtrips(ex);
}
Copy link
Member

Choose a reason for hiding this comment

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

Delete the whole file

Copy link
Author

Choose a reason for hiding this comment

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

Done

{
var ex = new SafeArrayRankMismatchException("E_BAD_PIZZA");
BinaryFormatterHelpers.AssertRoundtrips(ex);
}
Copy link
Member

Choose a reason for hiding this comment

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

Delete the whole file

Copy link
Author

Choose a reason for hiding this comment

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

Done

{
var ex = new SafeArrayTypeMismatchException("E_BAD_PIZZA");
BinaryFormatterHelpers.AssertRoundtrips(ex);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Delete the whole file

@karelz karelz modified the milestones: 2.1.0, 2.0.0 May 20, 2017
@karelz
Copy link
Member

karelz commented May 20, 2017

@morganbr this doesn't look like 2.0 work, moving to 2.1. It is against master branch, so this particular PR will be in 2.1 anyway.
If you have reasons to port it to 2.0, please create separate PR against rel/2.0.0 branch. Thanks!

@stephentoub
Copy link
Member

stephentoub commented May 20, 2017

Ensuring we ship the right serialization is definitely 2.0.

@stephentoub stephentoub modified the milestones: 2.0.0, 2.1.0 May 20, 2017
@karelz
Copy link
Member

karelz commented May 20, 2017

@stephentoub in that case we need another PR. This PR is against master, so it will go o its own only into 2.1 -- that's what the milestone should IMO track. Not the intent of other PRs, but the fact where this PR truly lands.
If we need to track a port, let's create a new issue to not forget to create the port into rel/2.0.0. Makes sense?

@karelz karelz modified the milestones: 2.1.0, 2.0.0 May 20, 2017
@stephentoub
Copy link
Member

Why have milestones on PRs at all then? After the fact you can just see where the commits are.

@karelz
Copy link
Member

karelz commented May 20, 2017

@stephentoub I am happy to chat, but the key thing is that I don't know how to get that information as quickly as just look at PR milestone.

@karelz
Copy link
Member

karelz commented May 20, 2017

Created porting bug #20041 to track the port to 2.0

@stephentoub
Copy link
Member

@karelz, if you're saying that we'll change the milestone on this PR to 2.0 once it's ported to release/2.0 and you simply don't want it to be changed before then, that's fine. If you're saying this PR would remain marked 2.1 and the porting PR would be marked 2.0, that doesn't make sense to me.

@karelz
Copy link
Member

karelz commented May 21, 2017

@stephentoub ok, now I am very interested. Obviously you think about milestones in entirely different way than I do and I was convinced that the way I look at them is the only way / natural way, which means I am "blind" and I am missing some angles. I would love to learn more / chat.

Here's my take / motivation (not trying to convince you, just explaining how I look at it):
Each (merged) PR results in commit(s) into exactly one branch. That branch ends up in some product version (and typically in all consequent versions).
Every PR in master which is merged into master before forking off for 2.0, should have 2.0 milestone.
Every PR in master which is merged after master forked off for 2.0, should have 2.1 milestone - that's where the change will ship.
Each issue can have multiple PRs associated in various branches. Its milestone should be the lowest product version where the fix/change is present. So today (i.e. 2.0 product ships out of rel/2.0.0 branch and master is 2.1 product), if I have 2.0 issue, I have to make a fix in master - that PR should be marked 2.1. Then (or simultaneously) I port the change into rel/2.0.0 - that PR should be marked 2.0. Once the 2.0 PR is merged, I should resolve the issue as 2.0.
There is also option to create 2 issues - one against 2.1 (with PR into master, also marked as 2.1) and one against 2.0 (with PR against rel/2.0.0, also marked as 2.0).

Now why all this?
Because when I look at old issues (esp. as external person), sometimes I want to know where the issue was fixed - is it already in 1.0 or do I have to use 1.1? (in future it will be 2.0 vs. 2.1 vs. 1.x) When I find issue, all is good. However, sometimes we have PRs without associated issues, so I might find that PR and want to know quickly, which release it went into.
I could of course look at associated commit and (assuming it is in master) either know when rel/1.1.0 was branched off (which IMO no one in practice knows), or know which branch I care about and then use git viewers to tell me if the commit is in that branch. Overall it is more work than just looking at the milestone of the PR/issue.

I am curious what's your view point. What I don't see?
BTW: I am totally guilty of having limited git knowledge - I still look at it as "yet another source control system" (like CSV, subversion, TFS, SD, etc.) with cheaper branches and more distributed model. So if there is something special/natural in git giving better answers to what I am trying to capture with milestones, I am likely missing it.

@stephentoub
Copy link
Member

However, sometimes we have PRs without associated issues, so I might find that PR and want to know quickly, which release it went into.

@karelz, consider this PR: #19997. Let's say it's a year from now. If the purpose of setting a milestone on a PR is to be able to quickly determine whether a given code change shipped in a given release, did that fix ship in 2.0? If you have to look at the thread to understand it, then what's the purpose of the milestone metadata, and if you don't look at the thread, then just looking at the milestone is going to give you the wrong answer; it says 2.1.0, but this fix is in 2.0.0, it was just a different PR that put it there.

@karelz
Copy link
Member

karelz commented May 21, 2017

Well, first line of that PR kind of suggests to look at the issue (which is 2.0 milestone) and it also mentions it is same as something in rel/2.0.0, which gives a hint this might be fixed in 2.0.
You are right it is not enough to look at the title and milestone only, but I had to read "just" the first line / first post, not the entire discussion to determine where the fix is.
Also, people can easily skim discussion for all linked PRs/issues - as soon as one of them says 2.0, they can dig deeper to check if it fixes the issue they are looking at.

BTW: Also, don't view this as perfect system, but IMO 99% things are correct. I spent some time back in November-January to fixup milestones of 1.0 and 1.1 issues & PRs. I bet I made a few mistakes exactly around forking times, especially when we had 2 bugs filed for 2 releases, without proper linking. The good news is, we can always fix it in future when particular questions are asked.
I am trying to make sure we handle the 2.0 -> 2.1 transition better and proactively now, instead of best-guessing retroactively later.

Overall having the milestones is IMO slightly better than not having them at all (i.e. PRs have always empty milestone), or having them used randomly. I am willing to spend the time on the updates (my OCD kicks in ;)) and if it helps just 1 person per quarter, I view it as reasonable investment. I know for sure that I can rely on the info when someone asks me "is X fixed in 2.0"?

@stephentoub
Copy link
Member

I am willing to spend the time on the updates (my OCD kicks in ;)) and if it helps just 1 person per quarter,

Then why stop where you're stopping? What is the downside to changing the milestone on a PR like the one I linked to 2.0? From my perspective, either the milestone should reflect the lowest version that contains that fix, or it's misleading. I don't see any gray area there.

@karelz
Copy link
Member

karelz commented May 21, 2017

There are 3 cases:

  1. There is no issue, just PR (this case)
  2. There is issue
  3. There are 2 issues (ideally one should say "port to 2.0: xyz")

In case (1) when there is only PR. Let's say you mark it as 2.0. It gets merged. Who is responsible for creating the PR against the other branch (rel/2.0.0, but it might be the other way)?
As IC developer I often lost track of the schedule, when is the last FI, etc. I still get these questions from people (on our team!), because they (like me in the past/now) don't read all the communication all the time. Especially when there are just subtle changes.
Therefore I won't rely on the fact that Morgan knows that master won't automatically make it into 2.0 release (he is even higher risk as he is not working primarily on .NET Core, so there is a good chance he doesn't know the plans and schedule). That's why I ask explicitly. And when I see danger things might get lost, I create tracking bugs, or reopen closed 2.0 bugs (quite a few HttpListener bugs) which were fixed only in master, to track the porting into rel/2.0.0. That's the only way how I can be sure the right things will happen and we won't miss porting things.
It always made me sad in the past, when I saw that we didn't fix something, because we forgot to port it into some branch. I have seen it happening (on products of the past) in the equivalents of master->rel/2.0.0 (i.e. we "forgot" to really fix the bug in the release we wanted to) and also rel/2.0.0->master branches (i.e. next version of product regressed a fix we had previously).
I take it as my duty to make sure that such things don't happen (or at least nearly don't happen). If it would happen, I would treat it as a failure on my side to track things properly.

@stephentoub
Copy link
Member

Let's say you mark it as 2.0. It gets merged. Who is responsible for creating the PR against the other branch (rel/2.0.0, but it might be the other way)?

We're talking past each other. I'm not saying mark it as 2.0 immediately when the PR is created, I'm saying mark it as 2.0 after it's in 2.0.

@karelz
Copy link
Member

karelz commented May 21, 2017

And to answer your question: Yes, I agree with your statement:

From my perspective, either the milestone should reflect the lowest version that contains that fix, or it's misleading.

But only in case (2) - when there is single issue tracking the fix and only for the issue. PRs (case (1)) are different as I tried to explain above.
And having 2 issues (case (3)) is kind of weird ... they can follow same model as (2), I don't care too much. What I care more about is that the issues are properly linked and you can click easily between related bugs/PRs.

@stephentoub
Copy link
Member

stephentoub commented May 21, 2017

The system simply does not make sense to me. The way this is set up, I can't trust milestones on PRs to mean anything meaningful; a PR might say 2.1 but the fix is actually already in 2.0. Either it shouldn't be set, or it should be accurate. I'll leave it at that.

@jkotas
Copy link
Member

jkotas commented May 21, 2017

I know for sure that I can rely on the info when someone asks me "is X fixed in 2.0"?

The only way to be sure is to check the history in release/2.0 branch. There are many opportunities for mistakes.

There is no issue, just PR (this case)

There is issue for this. It just was not linked with this PR. Anything important has an issue. I do not think that it is interesting to worry about the problem of PRs without an issue.

Each issue can have multiple PRs associated in various branches.

... and potentially multiple PRs in same branch, or multiple PRs in various repos. We have been on the single issue pointing to multiple PRs plan for regular development and for ask mode, and some of the time for servicing as well (when the fix in master is done at the same time as the servicing fix).

What I care more about is that the issues are properly linked and you can click easily between related bugs/PRs.

Right. The right way to do that is to ensure that any fix that goes to anywhere but master has the uber tracking issue linked to it.

@karelz
Copy link
Member

karelz commented May 21, 2017

We're talking past each other.

I'm happy to chat instead of typing ...

I'm not saying mark it as 2.0 immediately when the PR is created, I'm saying mark it as 2.0 after it's in 2.0.

I see, that was not clear to me. Sure, in theory why not, I probably don't care about that nuance, however it is quite a lot of additional work which I am personally not willing to do (not the right cost/benefit for me). Current system is easy to do for me via GH queries and bulk-edits (couple of minutes per day).
If I have to track which empty milestone is "someone forgot to set the milestone" vs. "this needs to get ported", it's quite extra overhead.

@jkotas

The only way to be sure is to check the history in release/2.0 branch. There are many opportunities for mistakes.

Sure. First I don't know how to do that. Git tooling is quite confusing for me in that area (maybe I am just dummy). Second I am 99% sure majority of our users won't do that - they will rather ask. If they get the answer (99% accurate) from the milestone, everyone's life is easier (especially mine).
Maybe there is room for GitHub improvements/tooling in the space ...

There is issue for this. It just was not linked with this PR. Anything important has an issue. I do not think that it is interesting to worry about the problem of PRs without an issue.

Well, I didn't know that. As we see, even experienced engineers like Morgan sometimes forget to link things :( ... so I assume we will have occasional cases like this one.
It would definitely help to have enforcement of such policy in GitHub itself (like TFS requires changeset for Fixed bugs).

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for removing the exception types. I did the same in my branch but will just merge your changes into it.

@morganbr morganbr merged commit 178a982 into dotnet:master May 23, 2017
@morganbr morganbr deleted the SerializationTestFixes branch May 23, 2017 18:52
morganbr added a commit to morganbr/corefx that referenced this pull request May 24, 2017
Fixes tests that depend on types in System.Private.CoreLib being serializable that won't be serializable soon.
krwq pushed a commit to krwq/corefx that referenced this pull request May 31, 2017
Fixes tests that depend on types in System.Private.CoreLib being serializable that won't be serializable soon.
krwq pushed a commit to krwq/corefx that referenced this pull request Jun 1, 2017
Fixes tests that depend on types in System.Private.CoreLib being serializable that won't be serializable soon.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants