-
Notifications
You must be signed in to change notification settings - Fork 147
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
XGraphics.FromPdfPage disposes object returned by static method #151
Comments
You are right. I have analyzed what I have done, and it seems that I operated ReSharper incorrectly in January this year during a code review. Instead of replacing |
Easy mistake to do and not immediately obvious :) maybe ReSharper ought to warn about returning objects that are being disposed? ;) |
There is a warning in VS at the return statement (can't say if it is ReSharper or VS), but easy to miss when you make a change five or six lines higher in the source code. |
I filed a ticket with JetBrains referring to this ticket just in case :) |
ReSharper really should not propose a change that makes the method unusable. At the return statement, they propose to remove the "using". |
as an aside, should using a disposed XGraphics instance throw an exception rather than silently fail? |
Above is the disassembly, but here is a link to the real source code:
At line 738, ReSharper now shows a warning and suggests to remove the using. Once the using is removed, ReSharper suggests at line 732 to either add a using block or a using declaration. |
Issue should be resolved with PDFsharp 6.2.0 Preview 2. |
Expected Behavior
Adding content to a document using XGraphics works
Actual Behavior
Document is blank
Steps to Reproduce the Behavior
Install PDFsharp 6.1.1 from nuget.org
Run this code
Inspect resulting pdf document
Workaround
Stop using that particular override by adding
, XPageDirection.Downwards
to the argument listReason for bug
Looking at disassembly, I found this:
The using statement in this static method disposes the object being returned, thus making it not work.
The text was updated successfully, but these errors were encountered: