-
Notifications
You must be signed in to change notification settings - Fork 555
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
Access Violation sometimes when trying to draw rectangles #1137
Comments
Is the On this note, why are you using the |
I actually tried the same code on the 16.8.0 and the problem did not happen. I did the OnUIThread to try to fix the problem. Because when the problem first occured, I tried several things and same issue. I finally decided to try on an older version of skiasharp and the problem did not happen. |
Are you able to attach a full stack trace? Does the issue still happen with 1.68.0 without the |
How do I attach a full stack trace? I am using WPF with .net core. I tried without the OnUIThread and the problem did not reoccur with 1.68.0. |
I tried to run it again after changing over to the new version and here is what i was able to copy. |
I checked the stack trace and it showed it as null. I did a screenshot but could not figure out how to send the screenshot. The problem would not happen every time but once in a while. |
You can just copy-paste the screenshot into the comments box. Or even drag the image into the comments. GitHub should just put the image in line. |
Thanks for letting me know. I tried that and worked. Here is the full screenshot now. You can see the stack trace actually showed null. |
Very interesting. Especially without the stack trace. Are you able to create a minimal repro at all? I will help to get started. |
I need help with creating a minimum repro. |
One question. If you mean to create a repository of the solution I was working on, I can do that. What I would do is to copy/paste and make sure they are all the same folder and that would be the repository. If that would be helpful, I can do that then. What would happen is I would create it where you can always hit next game. You will see that sometimes, the issue would happen. But does not happen every time you do new game though. The cases where it happens, its always at the beginning of new game. |
It would be great if you managed to get a repro with as little code as possible. Often just by trying to do that you see some weird things. But, I am looking at the code that you have here and maybe something is being disposed... thisCanvas.DrawRect(bounds, tempPaint);
thisCanvas.DrawRect(otherRect, currentPaint); Is it randomly different ones crashing? Or is it always the second one? Also, could it be that one of the paints What you can try and see if it is really this method that is failing is to replace the paints with And, another thing to try is to hit continue and see if there is another exception. Or check the output log for any info. Or, you can even check the "Common Language Runtime Exceptions" check box in the exceptions window. Maybe there is another exception that causes this exception. The whole thing without the stack trace is weird. One thing you can also try as well is using .NET Core. That might have a better exception. The fact that there is no stack trace may mean that there is an issue with the version of .net framework. We are using portable pdbs, and .net framework should support it, but this file does say that there are a few issues: https://github.com/dotnet/core/blob/master/Documentation/diagnostics/portable_pdb.md Maybe bump the version to net472 or even 48... |
I was actually using .net core 3.1 in wpf. |
I have same behavior
Steps to reproduce: |
I now have a simple sample to show this always happening eventually. To see it happening, just click new game. However, do several times. Eventually the error will occur. The problem did not happen with the 1.68.0. |
I have just published the PR (#1180) NuGet (1.68.2-pr.1180.4) to the preview feed: https://aka.ms/skiasharp-eap/index.json Give that a go and let me know if it fixes the crashes. |
How do I get the private feed one. I went to the preview on nuget and the latest version still showed 1.68.2-preview.43 |
You need to att https://aka.ms/skiasharp-eap/index.json to the feeds for nuget. In VS add a new package source. Check out this doc for a visual guide https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#package-sources |
Look in the drop down for 1.68.2-pr.1180.4 as this is a PR preview and it is somewhere in the middle of the previews |
I found it now. Just did not realize it would not be at the top. However, the same problem still occured even with that one. I was using windows 10 with wpf core. |
OK, might be something else. Is this link still the correct place? |
This is still the correct place. |
This is now fixed and no longer crashes on 1.68.2-preview.50 |
@mattleibow |
@axel578 I think that is another issue. It is most likely the image is actually a GPU image. Maybe try calling image.ToRasterImage to convert it to memory. If that doesn't work, then please make a new issue. Thanks! |
Description
When using skiasharp to draw rectangles, it gives access violation error.
This happens when I do from wpf and I use the SkElement and the first time it triggers the PaintSurface Event.
Code
on wpf is this
on cross platform is this
the 2 lines causing the problem is this
Expected Behavior
Expected behavior is to actually draw
Actual Behavior
Access violation on one of the 2 lines of code
Basic Information
version is 1.68.1.1
with wpf.
however, the part that raise the error and won't let me handle it is the cross platform skiasharp.
The text was updated successfully, but these errors were encountered: