Reloaded-Project / Reloaded.Memory.SigScan

Simple good performance byte pattern/PE signature scanner, allowing upwards of 5000MB/s per core (30000+MB/s with AVX) on modern hardware.
GNU Lesser General Public License v3.0
81 stars 15 forks source link

`System.Runtime.CompilerServices.Unsafe` Version Mismatch. #5

Closed Razmoth closed 2 years ago

Razmoth commented 2 years ago

Greetings.

While using SigScan v3.0.1, It asks for System.Runtime.CompilerServices.Unsafe v4.5.3, my project already has reference to System.Runtime.CompilerServices.Unsafe v5.0.0, and SigScan library requires >= v4.7.0 according to NuGet description.

image

image

image

image

Thanks in advance.

Sewer56 commented 2 years ago

Which TFM (Target Framework) is your application targeting?

I'll check quickly if it's a config issue.

Razmoth commented 2 years ago

NET Framework v4.7.2

Sewer56 commented 2 years ago

I've tried reproducing this in a clean new project however I've come up short.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>NET472</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Reloaded.Memory.Sigscan" Version="3.0.1" />
    <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
  </ItemGroup>

</Project>
// Dummy code
var code = new byte[12321];
var scanner = new Scanner(code);
scanner.FindPattern("00 FF 00");

Would you happen to be using the old .csproj format and/or packages.config? If so, this might be able to help.

Deleting the obj folders (or just doing a rebuild) might help too.

Razmoth commented 2 years ago

It's definitely related to binding redirect.

However, the issue is that the executable project will invoke a function from another Class Library project, which does not have app.config, trying to add it manually doesn't seem to help as well.

Project Used.

Apologize for explaining it poorly, but essentially there are 3 project (excluding Loader), 2 libraries 1 executable, the Bootstrapper will invoke a function from TypeTreeDumper, The TypeTreeDumper has the reference to SigScan and a dependency to Unity, of which it has the reference to System.Runtime.CompilerServices.Unsafe v5.0.0.

Inject Code: image

TypeTreeDumper.Bootstrapper.exe.config: image

image

image

image

image

If you don't mind, I can share the project files to test it out, I'd really appreciate it.

Thanks.

Sewer56 commented 2 years ago

Feel free, albeit I'd probably be troubleshooting in the exact same way that you are.
It's been a pretty long time since I've used Framework.

The initial screenshot with the stack trace errored at Span<T> which makes me think this could also potentially be related to System.Memory.

Razmoth commented 2 years ago

Guessed it right !! it was indeed System.Memory call, weird that PrivatePath is null despite it being set in TypeTreeDumper.Bootstrapper.exe.config.

image

Razmoth commented 2 years ago

I believe this is no longer an issue related with SigScan. will look into it on my own.

Thank you for the help

Sewer56 commented 2 years ago

No sweat, have fun and good luck.