Skip to content

Conversation

@adamsitnik
Copy link
Member

FileStreamHelpers was moved from System.IO to System.IO.Strategies namespace

namespace System.IO.Strategies
{
internal static partial class FileStreamHelpers

@ghost
Copy link

ghost commented Aug 12, 2021

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

FileStreamHelpers was moved from System.IO to System.IO.Strategies namespace

namespace System.IO.Strategies
{
internal static partial class FileStreamHelpers

Author: adamsitnik
Assignees: -
Labels:

area-System.IO

Milestone: 6.0.0

}

private static readonly Lazy<bool> _net5CompatFileStream = new Lazy<bool>(() => GetStaticNonPublicBooleanPropertyValue("System.IO.FileStreamHelpers", "UseNet5CompatStrategy"));
private static readonly Lazy<bool> _net5CompatFileStream = new Lazy<bool>(() => GetStaticNonPublicBooleanPropertyValue("System.IO.Strategies.FileStreamHelpers", "UseNet5CompatStrategy"));
Copy link
Member

Choose a reason for hiding this comment

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

Should we make this throw if the type can't be found?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking about it, but that would require special handling for when the PlatformDetection type is used to run Full .NET Framework tests. I decided to just add a test instead. Is that OK?

Copy link
Member

Choose a reason for hiding this comment

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

It's ok.

But I don't fully understand... tests on .NET Framework access _net5CompatFileStream.Value?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think Adam meant (please correct me if I'm wrong) that the PlatformDectection class, which contains the _net5CompatFileStream field, is also consumed by some .NET Framework tests. I can see the file can be built for both net60 and net461:
image

What I do not know is what special handling would be required to make the exception work.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've forgotten that it's lazy and only compiled for .NET 4.6.1 (not executed).

Copy link
Contributor

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

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

LGTM. Pending answering the question posted by Stephen.

}

private static readonly Lazy<bool> _net5CompatFileStream = new Lazy<bool>(() => GetStaticNonPublicBooleanPropertyValue("System.IO.FileStreamHelpers", "UseNet5CompatStrategy"));
private static readonly Lazy<bool> _net5CompatFileStream = new Lazy<bool>(() => GetStaticNonPublicBooleanPropertyValue("System.IO.Strategies.FileStreamHelpers", "UseNet5CompatStrategy"));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Adam meant (please correct me if I'm wrong) that the PlatformDectection class, which contains the _net5CompatFileStream field, is also consumed by some .NET Framework tests. I can see the file can be built for both net60 and net461:
image

What I do not know is what special handling would be required to make the exception work.

@adamsitnik adamsitnik merged commit cbc1f6a into dotnet:main Aug 12, 2021
@adamsitnik adamsitnik deleted the fixNet5FileStreamDetection branch August 12, 2021 18:41
@ghost ghost locked as resolved and limited conversation to collaborators Sep 11, 2021
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.

3 participants