Chronostasys / Blazor.Cropper

A blazor library provides component to crop image
MIT License
84 stars 19 forks source link

.NET 7 support #62

Open Velociapcior opened 1 year ago

Velociapcior commented 1 year ago

QUESTION Is it planned to release this package in .NET 7? Ut looks really awesome, and I would love to use it, but app i'm currently developing is in newest version of framework

Chronostasys commented 1 year ago

Hi @Velociapcior , an application targeting .Net 7 should be able to use a nuget package targeting .Net 6 just fine.
As .Net 7 is not a LTS version, we may not release the package in .NET 7.

angelru commented 1 year ago

I am using this nuget package in a .NET 7 blazor app and it works fine

Velociapcior commented 1 year ago

@angelru would you be so kind and show me a snippet of your index file in wwwroot in client app? I mean the part where you import Cropper js file, because I'm getting a 404 error when I import it like this:

    <script src="_framework/blazor.webassembly.js"></script>
    <script src="_content/MudBlazor/MudBlazor.min.js"></script>
    <script src="_content/Microsoft.Authentication.WebAssembly.Msal/AuthenticationService.js"></script>
    <script src="_content/Chronos.Blazor.Cropper/CropHelper.js"></script>

I investigated and found that when app is published, path for this file looks like this: _content/Blazor.Cropper/CropHelper.js

So when I change path for this file in index.html file, the file is indeed found, but I receive following error in console

Uncaught (in promise) Error: System.ArgumentException: There is no loaded assembly with the name 'Blazor.Cropper'.
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.GetRequiredLoadedAssembly(:5001/AssemblyKey assemblyKey)
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.ScanAssemblyForCallableMethods(:5001/AssemblyKey assemblyKey)
   at System.Collections.Concurrent.ConcurrentDictionary`2[[Microsoft.JSInterop.Infrastructure.DotNetDispatcher.AssemblyKey, Microsoft.JSInterop, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Collections.Generic.IReadOnlyDictionary`2[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.ValueTuple`2[[System.Reflection.MethodInfo, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Type[], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(:5001/AssemblyKey key, Func`2 valueFactory)
angelru commented 1 year ago
     <script src="_framework/blazor.webassembly.js"></script>
    <script src="_content/Chronos.Blazor.Cropper/CropHelper.js"></script>
    <script src="scripts/script.js"></script>
    <script src="scripts/download.js"></script>
adampanger commented 1 year ago

Image stream reading is currently not working with serverside Blazor using .NET 7 because it tries to read with that pre-NET 6 way. Made a pull request that fixes this issue and to use the .NET 6 version of stream reading with .NET 7 and onwards. #63