-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArgumentException: "Cannot pass a GCHandle across AppDomains" while running ASP.NET MVC application in the IIS Server. #2721
Comments
Hi team, Any update in this? Regards, |
I am also facing same problem. Any workaround or solution would be helpful. |
Hi Team, |
having similar issue and it crashed IIS every time. |
Hi Team, Any update on this issue? Any workaround or solution would be helpful, as we have been waiting for a while. |
I am not too familiar with the way IIS works, but SkiaSharp is using GCHandles to get direct access to memory for drawing and processing pixels. Is there a way to mark a controller as not usable across app domains? Maybe the image logic needs to be in a separate place that can be marked or controlled as such? I did a quick search and this came up: cefsharp/CefSharp#351 If anyone has more info on IIS and how this would work, please let me know. |
Any suggestion about this problem? |
Description
We are using the SkiaSharp library to generate an image using SKData in an ASP.NET MVC application. When running the MVC application as multiple sites(Use same folder for all the sites) in the local IIS Server under one application pool (using the same pool name for all the site), we encounter an ArgumentException while browsing in IIS.
Note: Initially build the MVC application locally in Visual studio, then run in local IIS server. This exception "Cannot pass a GCHandle across AppDomains" occurs randomly while browsing it in the IIS server.
Reproduction sample Link
Download the MVCSample.zip to replicate the problem.
Reference link for how to setup or install IIS server locally.
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-to-iis#install-iis
Reference link for how to add the ASP .NET MVC application as website on the IIS server by using the UI. Then create more sites like this with single MVC application.
https://learn.microsoft.com/en-us/iis/application-frameworks/scenario-build-an-aspnet-website-on-iis/configuring-step-1-install-iis-and-asp-net-modules#to-add-an-aspnet-application-by-using-the-ui
Code
Expected Behavior
SkiaSharp should create images properly without any errors when running an MVC application in multiple sites under one application pool in local IIS.
Actual Behavior
The following error we were faced randomly in the IIS server.
Exception Details: System.ArgumentException: Cannot pass a GCHandle across AppDomains.
Version of SkiaSharp
2.88.3 (Current)
Last Known Good Version of SkiaSharp
2.88.2 (Previous)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
No response
Devices
Basic Information:
• SkiaSharp Version with issue: 2.88.7
• IDE: Visual Studio Professional 2022 Preview 17.9.0 Preview 1.0
• Platform: Windows (Windows 11 Enterprise) version: 23H2
• Target Frameworks: ASP .NET MVC Application of .NET Framework 4.8
Relevant Screenshots
Relevant Log Output
Code of Conduct
The text was updated successfully, but these errors were encountered: