I got this error after upgrade to .NET Core SDK 3.1.102 and I do not see anything about this changing in doc
Thanks for contacting us. Can you please share a sample repro project, where you observe this issue.
@anurse I'm not certain about the area-label for this one. Can you please adjust? Thanks!
here are screenshots of 2 version that I installed in my PC
I am hitting this issue also. I have an XUnit integration test project defined which is failing with...
error CS0234: The type or namespace name 'Pipelines' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)
error CS0246: The type or namespace name 'PipeWriter' could not be found (are you missing a using directive or an assembly reference?)
Curiously, this only seems to be a problem when running the tests as part of my Docker (Debian) build. Running the same tests directly on my Windows PC via VS and CLI and they seem to pass!
I have code in my API project which accepts the PipeWriter
(BodyWriter) from the HttpContext
.
@mkArtakMSFT Minimal reproduction
Build using DockerfileOld works fine, but DockerfileNew fails. The only difference is the SDK and runtime image versions.
Looks like its busted for .NET Core as well as ASP.NET Core https://twitter.com/gcaughey/status/1230107136493072384
We are having the same issue. Worked before update, doesn't find pipelines after update.
Also see this.
If you add the System.IO.Pipelines package directly to your project it should work for now (until the framework ref is fixed).
Tagging @wtgodbe who just mentioned this elsewhere. It looks like the things that are packages built out of dotnet/corefx
but part of the "Microsoft.AspNetCore.App" Shared Framework aren't in the ref pack in 3.1.2. The workaround above is the right one for now, and we'll look at fixing this in the next patch :(
@rbhanda so that we can capture this in the release known issues doc.
Yes, this was an unfortunate mistake 鈽癸笍. Based on my current understanding of the problem, we'll have similar issues for all of the following packages:
and we'll look at fixing this in the next patch
Is that a soon patch or next month patch? (Since last month's was also broken https://github.com/dotnet/aspnetcore/issues/18334 and this was meant to be the fix for it); just seems a bad look to go for 2 months where creating a vanilla project (file new, or dotnet new) is broken.
We're still investigating what a fix looks like, but it's unlikely to be sooner than next month - we've already merged the rest of the fixes for next month's patch to begin validation, and our infrastructure is not well suited to releasing a one-off like this right now, though that is something that we are improving in .NET 5.
Ok, good to know. There might be an extra step to include in post packaging validation 馃槈
Indeed! We're already looking at what we missed here. Unfortunately, it turns out that shipping previews of ref-packs didn't adequately prepare us for the realities of servicing them.
Based on my current understanding of the problem, we'll have similar issues for all of the following packages:
Suspect only System.IO.Pipelines matters here. The rest of those packages are likely implementation details and not intended for us to expose.
The rest of those packages are likely implementation details and not intended for us to expose.
No, intended or not, they are exposed and must continue to be.
Agreed because people actively trim their dependency trees when they are picking them up from the framework anyway.
Going from 3.1.1 to 3.1.2, our ASP.NET Core app failed to start:
crit: Microsoft.AspNetCore.Hosting.WebHost[6]
Application startup exception
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=4.6.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'System.Data.SqlClient, Version=4.6.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
@johnkors and you did not update any SqlClient package explicitly? Just the runtime to 3.1.2? I believe this is related to the same issue as SqlClient relies on AccessControl and Principal.Windows
Only updating the runtime on the server and restarting the app, yes
@timheuer That should not be the same issue, for two reasons:
@johnkors I'm taking a look at the System.Data.SqlClient issue you pointed out. The problem seems to happen specially if your application depends on a .NET Framework library and use the System.Data shim, as that one has a new dependenciy to the System.Data.SqlClient nuget package version 4.8.1 for 3.1.2. Can you please try changing your ASP.NET Core app to reference the new version of System.Data.SqlClient and try to see if this issue still repros? Thanks in advance for your report and for checking.
@joperezr Confirmed, updating to System.Data.SqlClient/4.8.1
works with 3.1.2. Thanks! Btw, where can I check what versions of the shims are compatible with what runtimes? If we get this matrix, it's easier to reason if we can safely apply a runtime patch or not.
Btw, we are not referencing the compat pack (https://www.nuget.org/packages/Microsoft.Windows.Compatibility ), but we do have a direct reference in the app to System.Data.SqlClient/4.8.0
.
All runtime patches are supposed to work with OOB packages, the problem is that for 3.1 we changed the way we build these shims and it looks like that change broke this scenario. We are now working on servicing a fix for this which will make it such that all new runtime patches will work with future/past packages, so that there wouldn't be a need for any matrix.
Ok, that's even better.
if your application depends on a .NET Framework library and use the System.Data shim
Could you elaborate on this. I depend on a .NET Framework library, but how would I know if I'm using a shim? Where is this list of packages part of a shim? Would that be all the packages listed as a dependency for https://www.nuget.org/packages/Microsoft.Windows.Compatibility ?
Not exactly. Here is kind of the background for shims. Most of the types that exist in .NET Framework are also present in .NET Core, but they don't necessarily live in the same assembly. For example, the type System.String
lives in mscorlib.dll on .NET Framework, but it lives in System.Runtime.dll for .NET Core, similarly the type SqlNotificationRequest
lives in System.Data.dll in .NET Framework, but in System.Data.SqlClient.dll in .NET Core. When you are running a .NET Core application, and try to use a library that was targeting .NET Framework, it will try to load the types from the assemblies that it thinks they should live in, so when using String
, it will try to load it from mscorlib.dll, and when using SqlNotificationRequest
it will look for it in System.Data.dll.
System.Data.dll and mscorlib.dll only really have types in .NET Framework, so what we did here in order for .NET Framework libraries to be able to use all of these types that live in a different place, is to create what we call shims (sometimes we also refer to them as facades, or forwarders) which basically act as re-mappers or re-routers so that when a .NET Framework library tries to load a type from them, they will re-route the search to the assembly where they actually live in .NET Core.
Could you elaborate on this. I depend on a .NET Framework library, but how would I know if I'm using a shim?
All that said, this means that if you depend on a .NET Framework library, and this library uses any types from System.Data.dll, then that most likely means that at runtime in .NET Core, we will have to load the System.Data.dll shim in order to re-route all of the types to the right place. You could inspect your .NET Framework dependency to check if it references System.Data.dll and inspect with ildasm to see if it actually uses one of System.Data types.
Where is this list of packages part of a shim?
We used to pack all of these shims in the Compatibility package, but now we pack them all as part of the runtime. The reason is that many people where trying to load .NET Framework assemblies from .NET Core, and didn't find it very intuitive to require adding an extra NuGet package reference, so all of the .NET Framework shims are now shipped as part of the shared framework everytime you target a new runtime or download a new SDK.
So why is this causing trouble now? Well, the problem is that we recently changed how we build these shims in order to use a much more robust infrastructure, and we missed one key difference that lead to this bug you are hitting. I merged yesterday a PR that will mitigate this for the System.Data.SqlClient case (PR https://github.com/dotnet/corefx/pull/42868 which will be shipped for 3.1.3 rutnime) and will work on making this infrastructure m ore robust to make sure these kind of problems never happen again.
I hope all of that made sense, but if not, feel free to ask me to clarify 馃槃
Great description, @joperezr
We used to pack all of these shims in the Compatibility package, but now we pack them all as part of the runtime. The reason is that many people where trying to load .NET Framework assemblies from .NET Core, and didn't find it very intuitive to require adding an extra NuGet package reference, so all of the .NET Framework shims are now shipped as part of the shared framework everytime you target a new runtime or download a new SDK.
When was this introduced? Thank you.
Also, as an anecdote, a JavaScript developer asked me, "Why C#" and "Why DotNet" in 2020. After thinking deeply about the problem, I enumerated the areas where choosing this stack slowed me down, and the total sunk cost incurred learning .NET Core in depth. My main pain points have been around understanding "Out-of-box assemblies" and Shims, but also: Since Out-of-box assemblies are shipped as Nuget package references, there is the following unexpected behavior possible: Nuget package reference Version 4.8 targeting net48 might have a different assembly version than the same Nuget package reference Version 4.8 targeting netstandard2.0. _This is the number one non-intuitive experience, and the one I saw the .NET team continuously punt on fixing. Should this have a separate issue for discussion? I've explained the issue elsewhere, and I just wonder if my medium for my message was poorly chosen._ Transclusion of shims doesn't solve this problem. It also doesn't answer the fundamental question: Where is this list of packages part of a shim? - because the real question isn't "Where is this list of packages part of a shim?" but rather "What packages ship which assemblies as part of the shim?" Hope that makes sense.
When was this introduced? Thank you.
It was introduced for our 3.0 release with PR https://github.com/dotnet/corefx/pull/37550~~
EDIT I thought you were asking for the change in the generation of the shims. As for the shims we include in the runtime, this has been progressive, as since 1.0 we includded some of the shims but not all, and have been adding more and more .NET Framework shims from the compatibility package to the actual runtime when we see that people start requiring other shims.
Nuget package reference Version 4.8 targeting net48 might have a different assembly version than the same Nuget package reference Version 4.8 targeting netstandard2.0
While I completely agree with you that understanding how OOB assemblies work, and that this aspect you point out in NuGet packages is very confusing, we really have little to no choice on doing so. If we wanted that all assemblies inside a NuGet package had the same assembly version, then we wouldn't be able to grow API as much as we do on our OOB assemblies. Here is an example. Imagine you have an OOB package that contains Foo.dll for netstandard1.0 and netstandard2.0 and both of them had the same assembly version 1.0.0.0. Then, you decide you want to add new method overloads to your API that for example, take Span as a parameter on an overloaded function. The problem here is that Span doesn't work in netstandard1.0. It would be wrong to just add the API to one of the two assemblies, but increase the assembly version on both, since now you would have a bigger problem where two dlls with the same assembly version have different API, which goes against the design guidelines of .NET, and will cause many more problems at runtime. That is why whenever we want to do this, we just add the API to the places in the package where this is possible, and increase the assembly version of only those assets in the package. This of course over time, will mean that our OOB packages contain several different assemblies with different surface area, and different Assembly versions.
First of all, thanks for the very thorough response 馃憦 Really appreciate the details!
I was unaware of the deprecation of the compat package moving it to the runtime, though. Is there a blog post or release notes somewhere talking about it? It's not mentioned in any of the migration docs..?
I think I explained myself incorrectly above 馃う鈥嶁檪. The package isn't deprecated, and it still contains more shims than the ones we ship with the runtime so it is still a viable alternative for people hitting .NET Framework vs .NET Core problems, but what I really meant is that we have gradually added more and more shims into the runtime as we keep seeing some shims are more often required than others.
~It was introduced for our 3.0 release with PR dotnet/corefx#37550~
EDIT I thought you were asking for the change in the generation of the shims.
I was indeed asking for the change. Thank you.
As far as
That is why whenever we want to do this, we just add the API to the places in the package where this is possible, and increase the assembly version of only those assets in the package. This of course over time, will mean that our OOB packages contain several different assemblies with different surface area, and different Assembly versions.
That all makes sense to me now, but:
Anyway, I can't tell if I'm rambling, but this is "the pain behind the pain".
Those are totally valid points and I agree with all of them. I do have an issue on my backlog https://github.com/dotnet/runtime/issues/26002 which the title is a little confusing but basically what we wanted is to change the description of our packages, to instead also provide a table with all the assemblies contained in the package with their corresponding assembly versions, so that people might find this helpful when looking if a package contained a specifc API or not. I haven't made much progress on that issue because it got de-prioritized at the time, but if enough people think that this feature on the packages would at least help filling the gaps that nuget.org, fuget, or VS don't show, we can work on prioritizing that again.
I do have an issue on my backlog dotnet/runtime#26002 which the title is a little confusing
Let's update it then! 馃榾
mark, same build error in ubuntu 18.04
error CS0234: The type or namespace name 'Pipelines' does not exist in the namespace 'System.IO'
I encountered this a few days ago and simply uninstalled 3.1.200 to revert to a working build.
I use VS preview which has just rolled out a new version packaged with 3.1.200
It seems I cannot uninstall this component meaning, unless someone has any ideas (@Pilchie ?), I'm now forced to uninstall VS preview(??)
Here's hoping a fix is found soon 馃嵒
@AdamWillden - you can work around the problem by adding a Package Reference to System.IO.Pipelines until the next runtime ships.
@Pilchie I just came to the same conclusion - now I feel stupid 馃う鈥嶁檪
Is still still an issue with .NET Core 3.1.3?
@jawn
Is still still an issue with .NET Core 3.1.3?
I've upgraded and it seems to be fixed.
Is still still an issue with .NET Core 3.1.3?
Same here, 3.1.3 resolved the issues with referencing System.Data.SqlClient/4.8.0
.
Yes, @wtgodbe fixed this for 3.1.3. I'll close it. Note that System.Data.SqlClient was actually a unique issue in the dotnet/corefx
repo that was also fixed for 3.1.3.
Most helpful comment
Ok, good to know. There might be an extra step to include in post packaging validation 馃槈