sharpcompress
sharpcompress copied to clipboard
System.Text.Encoding.CodePages depencency problem
I have a MVC function that I'm migration to an Azure Function. During the migration, I ran in some kind of dependency problem:
FileLoadException: Could not load file or assembly 'System.Text.Encoding.CodePages, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Somehow there is a problem concerning netstandard2.0 and sharpcompress 0.22.0. I'm not sure what the cause is, but downgrading to 0.21.0 solved it.
Maybe I can help somebody to save the hours that I lost figuring this out. And maybe a fix can be created for 0.23.0?
If any extra information is needed, just let me know.
Looks like updating the CodePages version to 4.5.0 from 4.4.0 busted it.
I have a feeling it's to do with the recent stuff talking about now .NET 4.6.1 isn't really supported by .NET Standard 2.0 since it was retrofitted. Discussed around here: https://github.com/dotnet/standard/issues/481 or https://github.com/dotnet/standard/issues/514
There was a tweet thread I can't find but blamed it on that.
It looks like Azure Functions 2.0 is .NET Core so maybe try that :)
That's not possible (yet): https://github.com/Azure/Azure-Functions/issues/805
I don't see the issue if your libraries all target netstandard20. You should be targetting that with everything except the actual executable which could be netcoreapp20 or netcoreapp21.
I'm just guessing that the azure function itself is just a library (targetting netstandard20) since the instance is the loading the library to execute it. Azure Functions v1 is net461 or something and Azure Functions v2 is netcoreapp20.
In the issue I references, you can find a link to https://github.com/Azure/azure-functions-vs-build-sdk/issues/160#issuecomment-386402717. You can compile with targetframework netcoreapp20, but it crashes with a runtime error...
Building lambda function for aws. have the same issue. when downgraded back to 4.5.1 started working.
We have the same issue where SharpCompress is the only project pulling in System.Runtime.CompilerServices.Unsafe
version 5.0.0. Other code pulls in 4.5.3 (file version 4.0.4.1) through System.Memory.
It doesn't look SharpCompress needs that later version.
.net 4.8 same
Any updates?