-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
System.Resources.Extensions.Tests.FormattedObject.BasicObjectTests.BasicObjectsRoundTripAndMatch failure #104905
Comments
Tagging subscribers to this area: @dotnet/area-system-resources |
cc @adamsitnik - test was added in #102379 |
Adding some detail about the failure. Seems this was deserializing a WeakReference object:
Here's the corresponding test data: Seems pretty odd to me that this would be flaky. Any theories, @adamsitnik? |
The test failed when comparing the lengths of a streams that contained:
Lines 39 to 40 in bec5970
My theory: Repro: using System.Runtime.Serialization.Formatters.Binary;
Uri? dotnetUri = new("https://dot.net");
WeakReference weakReference = new(dotnetUri, true);
BinaryFormatter binaryFormatter = new();
MemoryStream memoryStream = new();
binaryFormatter.Serialize(memoryStream, weakReference);
Console.WriteLine($"IsAlive: {weakReference.IsAlive}, Length: {memoryStream.Length}");
memoryStream.Position = 0;
memoryStream.SetLength(0);
dotnetUri = null;
do
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
} while (weakReference.IsAlive);
binaryFormatter.Serialize(memoryStream, weakReference);
Console.WriteLine($"IsAlive: {weakReference.IsAlive}, Length: {memoryStream.Length}");
|
…reed by the GC during test run, fixes dotnet#104905
I just hit this in #105339, which was opened after and which includes the fix for this issue...
|
In #105072 I've rooted the target of I was expecting that this is going to prevent the GC from feeing it. @stephentoub do you have any idea what I am missing here? (I've simply run out of ideas for now) |
Thanks. Let's close this again and see if any further occurrences are reported separately. It's possible there was some kind of staleness happening. |
I hit this in #106040
Config: net9.0-windows-Release-x64-coreclr_checked-Windows.10.Amd64.Open |
I am moving it to 10 as it's not a product issue, but a flaky test. |
…t freed in the meantime, fixes dotnet#104905
…t freed in the meantime, fixes dotnet#104905 (dotnet#106967)
* 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>
…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>
…t freed in the meantime, fixes dotnet#104905 (dotnet#106967)
…t freed in the meantime, fixes dotnet#104905 (dotnet#106967)
Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=739427
Build error leg or test failing: System.Resources.Extensions.Tests.FormattedObject.BasicObjectTests.BasicObjectsRoundTripAndMatch
Pull request: #104749
Error Message
Fill the error message using step by step known issues guidance.
Known issue validation
Build: 🔎⚠️ Provided build not found. Provide a valid build in the "Build: 🔎" line.
Result validation:
Validation performed at: 8/14/2024 10:23:52 PM UTC
Report
Summary
The text was updated successfully, but these errors were encountered: