You read the data in chunks. Each chunk must be a single span. Sensible chunks are basically page sized (e.g. 4k). To read the next chunk, you construct a new reader, passing in the next block and the current reader state.
What's the recommendation about using a password on the private key? Is there a reason to?
I wouldn't bother. Just check it in as-is.
If not, wouldn't it make sense for the project templates to just set this up as the default?
We discussed this, but it seemed over the top for general libraries. It's the same as with NuGet packages. It makes sense for libraries you ship publicly, but not all libraries will be released to the general public, so it seems like overkill for the template.
I believe we'll add them here. Until then, you can grab them from here.
1. Any alternative or best practice to using the preprocessor directives (eg. #if NET461, #if WINDOWS_UWP)? Looks like it can get smelly (open closed principle and web analogy would be "if IE version X")
As few as possible would be my advice. You can also configure your MSBuild project to selectively include files on a naming convention. That's what Xamarin Essentials are doing.
2. What is the recommended approach to unit testing a .NET Standard library? (eg. separate test project per target framework or preprocessor directives)
Right now, I'd recommend separate projects and a Shared Project to centralize the source code for the tests.
This package is a logical extension of .NET Standard 2.0 that significantly increases API set and existing code compiles with almost no modifications. But in order to keep the promise of .NET Standard ("it is the set of APIs that all .NET implementations provide"), this didn't include technologies that can't work across all platforms, such as registry, Windows Management Instrumentation (WMI), or reflection emit APIs.
The Windows Compatibility Pack sits on top of .NET Standard and provides access to technologies that are Windows only. It's especially useful for customers that want to move to .NET Core but plan to stay on Windows as a first step. In that scenario, not being able to use Windows-only technologies is only a migration hurdle with zero architectural benefits.
Regarding this question:
Why hasn't Microsoft started build some kind of cross platform abstraction api for common tasks?
You mean like a set of APIs that cover basic tasks like reading files, accessing the network, or parsing documents? Yeah, that's what .NET Standard is (a)
Seriously, what APIs would like to see being abstracted?
@TerraJobst Great! A big concern about PoShCore is compatibility with scripts, DSC resource modules, and DSC configurations written for Windows PoSh 5.1, but this Compatibility Pack might be very important for reducing these fears. Can you share any testing or plans in this regard? Thanks!
The PowerShell team would be better suited to answer these questions. I suggest you ask here.
I hope I will see these things also light up in the full .NET Framework.
Span<T> will be available for .NET Framework via a NuGet package. This won't give you all the features that would require adding APIs to existing types.
Is it possible to target .NET 4.6 and reference some Nuget packages to create Span/Memory based APIs today which will run faster once .NET 4.7.2 arrives?
Yes, but Span<T> is only available as a preview. I won't ship as a stable before next year.
Comments
Try the new System.Text.Json APIs!
You read the data in chunks. Each chunk must be a single span. Sensible chunks are basically page sized (e.g. 4k). To read the next chunk, you construct a new reader, passing in the next block and the current reader state.
https://docs.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonreader.-ctor?view=netcore-3.0#System_Text_Json_Utf8JsonReader__ctor_System_Buffers_ReadOnlySequence_System_Byte__System_Boolean_System_Text_Json_JsonReaderState_
This allows you to fetch the next chunk in an async manner. Here is an example: https://docs.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonreader.-ctor?view=netcore-3.0#System_Text_Json_Utf8JsonReader__ctor_System_Buffers_ReadOnlySequence_System_Byte__System_Boolean_System_Text_Json_JsonReaderState_
Try the new System.Text.Json APIs!
Build Great Libraries using .NET Standard
I wouldn't bother. Just check it in as-is.
We discussed this, but it seemed over the top for general libraries. It's the same as with NuGet packages. It makes sense for libraries you ship publicly, but not all libraries will be released to the general public, so it seems like overkill for the template.
Build Great Libraries using .NET Standard
I believe we'll add them here. Until then, you can grab them from here.
As few as possible would be my advice. You can also configure your MSBuild project to selectively include files on a naming convention. That's what Xamarin Essentials are doing.
Right now, I'd recommend separate projects and a Shared Project to centralize the source code for the tests.
Windows Compatibility Pack for .NET Core
I've explained this in the documentation:
Regarding this question:
You mean like a set of APIs that cover basic tasks like reading files, accessing the network, or parsing documents? Yeah, that's what .NET Standard is (a)
Seriously, what APIs would like to see being abstracted?
Windows Compatibility Pack for .NET Core
The PowerShell team would be better suited to answer these questions. I suggest you ask here.
Windows Compatibility Pack for .NET Core
Yes, the package installs into .NET Standard projects as well. See the spec for scenarios.
C# 7.2: Understanding Span
@YourMotherInLaw: I see what you did there. But you need to reduce the number of comments you're allocating ;)
@Alois Kraus:
Span<T> will be available for .NET Framework via a NuGet package. This won't give you all the features that would require adding APIs to existing types.
Yes, but Span<T> is only available as a preview. I won't ship as a stable before next year.
Windows Compatibility Pack for .NET Core
@Jason:Yes, we've been working closely with the PowerShell team on .NET Core. Do you have specific concerns or questions?
Getting Started with .NET Standard 2.0 Part 1 with Immo Landwerth
Hah! He has a strong (tele) presence. He's always around :)
Getting Started with .NET Standard 2.0 Part 1 with Immo Landwerth
Thanks Maria! Normally I don't get accused of being too quiet :)
Get started with VS Code using C# and .NET Core on a Mac
Great video but the papers are highly distracting. Get your office in order! ;)