mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-07 21:22:04 +00:00
VB.NET in VS2017 - Referencing .NET 5.0 in the Framework 2.1 DLL #464
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @RepeatSoftware on GitHub (Jun 8, 2021).
Using with VB.NET and tried using:
sharpcompress-master\src\SharpCompress\bin\Debug\netstandard2.0
sharpcompress-master\src\SharpCompress\bin\Debug\netstandard2.1
Code:
At the "Dim archive " line, I get:
Import of type 'Stream' from assembly or module 'System.Runtime.dll' failed.
and I run the file, I get:
namespace SharpCompress.Common
{
public class OptionsBase
{
///
/// SharpCompress will keep the supplied streams open. Default is true.
///
public bool LeaveStreamOpen { get; set; } = true;
}
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'SharpCompress.Common.ArchiveEncoding' threw an exception.
Inner Exception 1:
FileNotFoundException: Could not load file or assembly 'System.Text.Encoding.CodePages, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Any ideas please?
Many thanks
Mark
@adamhathcock commented on GitHub (Jun 9, 2021):
This all depends on what legacy framework you have installed and what netstandard version that it supports.
I'm not supporting legacy framework use cases as it's painful. Best I can do is help fix any bugs that happen in netstandard2.0 use cases.
@RepeatSoftware commented on GitHub (Jun 9, 2021):
Hi Adam
Thanks for coming back to me.
I have all my stuff running on Framework 4.6.1 at the moment. Looks like I would have to update to Framework 5.0 if I want to use your stuff unless there is any quick way I can get it working on this framework?
Thanks
Mark.
From: Adam Hathcock @.>
Sent: 09 June 2021 09:55
To: adamhathcock/sharpcompress @.>
Cc: Mark Adams @.>; Author @.>
Subject: Re: [adamhathcock/sharpcompress] VB.NET in VS2017 - Referencing .NET 5.0 in the Framework 2.1 DLL (#604)
This all depends on what legacy framework you have installed and what netstandard version that it supports.
I'm not supporting legacy framework use cases as it's painful. Best I can do is help fix any bugs that happen in netstandard2.0 use cases.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/adamhathcock/sharpcompress/issues/604#issuecomment-857515352, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJFDS6NM2TT5A6KPPRRCPJLTR4T5RANCNFSM46JSBTIQ.
@adamhathcock commented on GitHub (Jun 14, 2021):
I think 4.7.2 is what is officially supported....I've long forgotten.
I understand there are a lot of people still on legacy frameworks and will continue to be for a long time. However, I can't continue to support this so I've moved SharpCompress on to NetStandard 2.0 (1.x isn't supported anymore) but that may break soon as well with the new Span/Memory work and async/await branches.
I'm not sure what to tell you to do as I generally see the Open Source community not wanting to support legacy frameworks unless they themselves are using them.
@RepeatSoftware commented on GitHub (Jun 14, 2021):
Hi Adam
OK. Thanks your help. I couldn’t get the Framework 2.0 working so will try an older version when I get chance,
Regards
Mark.
From: Adam Hathcock @.>
Sent: 14 June 2021 13:10
To: adamhathcock/sharpcompress @.>
Cc: Mark Adams @.>; Author @.>
Subject: Re: [adamhathcock/sharpcompress] VB.NET in VS2017 - Referencing .NET 5.0 in the Framework 2.1 DLL (#604)
I think 4.7.2 is what is officially supported....I've long forgotten.
I understand there are a lot of people still on legacy frameworks and will continue to be for a long time. However, I can't continue to support this so I've moved SharpCompress on to NetStandard 2.0 (1.x isn't supported anymore) but that may break soon as well with the new Span/Memory work and async/await branches.
I'm not sure what to tell you to do as I generally see the Open Source community not wanting to support legacy frameworks unless they themselves are using them.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/adamhathcock/sharpcompress/issues/604#issuecomment-860634009, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJFDS6NENFQ2RP3JKRNJFHLTSXWTBANCNFSM46JSBTIQ.
@adamhathcock commented on GitHub (Jun 15, 2021):
Looks like the official MongoDB driver uses 0.23.0 and will likely stay there until they drop some kind of legacy support.
@barkermn01 commented on GitHub (Jul 25, 2021):
There is another refference to .Net 5 to this as well in Dec 2019 specifically
80b0671844starts usingT[].AsSpan()method it is only available in .Net 5https://docs.microsoft.com/en-us/dotnet/api/system.memoryextensions.asspan?view=net-5.0&viewFallbackFrom=netframework-4.8#System_MemoryExtensions_AsSpan__1___0___System_Index_
Exception Could not find file or assembly
'System.Runtime.CompilerServices.Unsafe', Version=4.0.4.1'triggered fromvar lzma = new SharpCompress.Compressors.LZMA.LzmaStream(props, new System.IO.MemoryStream(cdata));because of https://github.com/adamhathcock/sharpcompress/blob/master/src/SharpCompress/Compressors/LZMA/LzmaStream.cs#L61@YoshiRulz commented on GitHub (Sep 30, 2021):
Ah, it's not just me then. BizHawk was also affected by this
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.(this is from our Standard 2.0 library uesd by our Framework 4.8 app). Strangely, it didn't seem to affect local builds on Windows or Linux, only those made in GitLab CI. I tried unsuccessfully to override the transient dep but ended up downgrading SharpCompress to0.26.0.@adamhathcock commented on GitHub (Oct 1, 2021):
Looks like this might be cleared up as the
net461target will be put back here: https://github.com/adamhathcock/sharpcompress/pull/621@adamhathcock commented on GitHub (Oct 2, 2021):
net461 back here https://www.nuget.org/packages/SharpCompress/0.30.0
@RepeatSoftware commented on GitHub (Oct 2, 2021):
Just installed up. Up and fully working on .NET 4.7.2. Thanks a lot for that. Means I can go back to a project I've put on hold. Cheers.
@YoshiRulz commented on GitHub (Oct 3, 2021):
Unfortunately
0.30.0doesn't fix our problem, the same exception is thrown, again only by CI builds. Shall I open a new issue?@adamhathcock commented on GitHub (Oct 3, 2021):
If you're using net48 it should be using net461.
I remember reading sometimes the incorrect target being used.
@YoshiRulz commented on GitHub (Jan 25, 2022):
Figured it out. When I forced
System.Runtime.CompilerServices.Unsafe = 4.5.3it didn't work because that's outside the lower bound>= 5.0.0inherited viaSharpCompress. By simply forcing it up to5.0.0, all the version constraints are satisfied and our app runs normally.@SplitGemini commented on GitHub (May 9, 2023):
.net 4.8 can't load 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'