Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Don't use WeakReferences in the BF round trip test - #106967

#106967
Merged
adamsitnik merged 1 commit into
dotnet:maindotnet/runtime:mainfrom
adamsitnik:weakReferenceBfTestsadamsitnik/runtime:weakReferenceBfTestsCopy head branch name to clipboard
Aug 29, 2024
Merged

Don't use WeakReferences in the BF round trip test#106967
adamsitnik merged 1 commit into
dotnet:maindotnet/runtime:mainfrom
adamsitnik:weakReferenceBfTestsadamsitnik/runtime:weakReferenceBfTestsCopy head branch name to clipboard

Conversation

@adamsitnik

Copy link
Copy Markdown
Member

In #105072 I've tried to fix #104905 by rooting the argument provided to the test method.

It turned out to be incomplete, as this test performs a full round trip (serialize -> deserialize) and I was not rooting the deserialized weak reference target:

I could try to do that by doing sth like this:

object bfdeserialized = formatter.Deserialize(serialized);
object? root = bfdeserialized is WeakReference weakReference ? weakReference.Target : null;
// rest of the test
GC.KeepAlive(root);

But in theory GC could free the WeakReference target after it got deserialized by BF, but before returned from BinaryFormatter.Deserialize. Since this test was flaky for a while and I don't ever want to hear about it, I propose to simply don't test weak references for this particular scenario (it's used by other tests so no worries)

fixes #104905

@adamsitnik

Copy link
Copy Markdown
Member Author

/ba-g the timeouts are unrelated

@adamsitnik
adamsitnik merged commit 8983904 into dotnet:main Aug 29, 2024
adamsitnik added a commit to adamsitnik/runtime that referenced this pull request Sep 9, 2024
github-actions Bot pushed a commit that referenced this pull request Sep 17, 2024
carlossanlop pushed a commit that referenced this pull request Sep 17, 2024
* Remove package references from library tests (#106737)

* Remove package references from library tests

These tests should be referencing the product assemblies so that they
test latest and not old bits.

* Reference the OOB version of SRSF and make sure it's copied

* BinaryFormatter tests should be skipped only on AOT, WASM and Mobile (#106858)

* respect AppContext switch (which is currently enabled for all projects in the root Directory.Build.props file)

* add project reference to all test projects that need working BF (and were being skipped for a while)

* adjust to changes from #104202: EqualityComparer<string>.Default is mapped to StringEqualityComparer, but serialized as GenericEqualityComparer<string>

* Don't use WeakReferences in the round trip test, as the target may get freed in the meantime, fixes #104905 (#106967)

* Enable more BinaryFormatter tests (#107408)

* enable the BinaryFormatter tests in System.Runtime.Serialization.Formatters.Tests

* add new test project, where the flag is disabled and it runs only 3 tests in total that ensure that

* The SerializationGuard is no longer activated since BF was moved to the OOB package, the tests need to reflect that.

* Disable binary formatter tests when DotNetBuildSourceOnly. (#107549)

* [mono][tvos] Do not treat assembly.pdb/xml files as native files to bundle when AOTing on Helix (#107079)

* Do not treat assembly.pdb/xml files as native files to bundle

* Bundle satellite assemblies as well

* [mono][ci] Include PDBs from runtime pack when building on Helix if required (#107348)

---------

Co-authored-by: Eric StJohn <ericstj@microsoft.com>
Co-authored-by: Tom Deseyn <tom.deseyn@gmail.com>
Co-authored-by: Ivan Povazan <55002338+ivanpovazan@users.noreply.github.com>
carlossanlop pushed a commit that referenced this pull request Sep 17, 2024
…107903)

* Remove package references from library tests (#106737)

* Remove package references from library tests

These tests should be referencing the product assemblies so that they
test latest and not old bits.

* Reference the OOB version of SRSF and make sure it's copied

* BinaryFormatter tests should be skipped only on AOT, WASM and Mobile (#106858)

* respect AppContext switch (which is currently enabled for all projects in the root Directory.Build.props file)

* add project reference to all test projects that need working BF (and were being skipped for a while)

* adjust to changes from #104202: EqualityComparer<string>.Default is mapped to StringEqualityComparer, but serialized as GenericEqualityComparer<string>

* Don't use WeakReferences in the round trip test, as the target may get freed in the meantime, fixes #104905 (#106967)

* Enable more BinaryFormatter tests (#107408)

* enable the BinaryFormatter tests in System.Runtime.Serialization.Formatters.Tests

* add new test project, where the flag is disabled and it runs only 3 tests in total that ensure that

* The SerializationGuard is no longer activated since BF was moved to the OOB package, the tests need to reflect that.

* Disable binary formatter tests when DotNetBuildSourceOnly. (#107549)

* [mono][tvos] Do not treat assembly.pdb/xml files as native files to bundle when AOTing on Helix (#107079)

* Do not treat assembly.pdb/xml files as native files to bundle

* Bundle satellite assemblies as well

* [mono][ci] Include PDBs from runtime pack when building on Helix if required (#107348)

---------

Co-authored-by: Eric StJohn <ericstj@microsoft.com>
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Co-authored-by: Tom Deseyn <tom.deseyn@gmail.com>
Co-authored-by: Ivan Povazan <55002338+ivanpovazan@users.noreply.github.com>
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Resources test-enhancement Improvements of test source code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.Resources.Extensions.Tests.FormattedObject.BasicObjectTests.BasicObjectsRoundTripAndMatch failure

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.