Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSharpier removes blank line between if statement and unsafe block #917

Closed
fgimian opened this issue Jun 24, 2023 · 2 comments 路 Fixed by #918
Closed

CSharpier removes blank line between if statement and unsafe block #917

fgimian opened this issue Jun 24, 2023 · 2 comments 路 Fixed by #918
Labels
area:formatting type:bug Something isn't working
Milestone

Comments

@fgimian
Copy link

fgimian commented Jun 24, 2023

Hey there, hope you're doing great! 馃槃 Thank you so much for this amazing tool, absolutely love it!

I only encountered one minor issue while formatting my codebase:

    public void Deactivate()
    {
        if (!_attached)
        {
            return;
        }
        unsafe
        {
            uint currentThreadId = PInvoke.GetCurrentThreadId();
            uint targetThreadId = PInvoke.GetWindowThreadProcessId(Handle, lpdwProcessId: null);
            if (PInvoke.AttachThreadInput(currentThreadId, targetThreadId, fAttach: false) != 0)
            {
                _attached = false;
            }
        }
    }

Notice that CSharpier removed the blank line between my if and unsafe blocks. It doesn't do this for other block types (e.g. if I have multiple if statements after one another, so I suspect that maybe the unsafe keyword was not accounted for?

Thank you so much in advance!
Fotis

@belav
Copy link
Owner

belav commented Jun 24, 2023

Thank you so much for this amazing tool, absolutely love it!

You're welcome, I'm happy to hear that!

so I suspect that maybe the unsafe keyword was not accounted for?

This was pretty much it. Just a single line fix, unsafe slipped through when having CSharpier take into account existing new lines between statements.

Thanks for reporting it! The 0.25 release should be out soonish.

@belav belav added this to the 0.25.0 milestone Jun 24, 2023
@belav belav added type:bug Something isn't working area:formatting labels Jun 24, 2023
shocklateboy92 added a commit that referenced this issue Jun 24, 2023
closes #917

Co-authored-by: Lasath Fernando <devel@lasath.org>
@fgimian
Copy link
Author

fgimian commented Jun 24, 2023

Thank you so much for this amazing tool, absolutely love it!

You're welcome, I'm happy to hear that!

so I suspect that maybe the unsafe keyword was not accounted for?

This was pretty much it. Just a single line fix, unsafe slipped through when having CSharpier take into account existing new lines between statements.

Thanks for reporting it! The 0.25 release should be out soonish.

Thank you so much for your help! 馃槃

Cheers
Fotis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:formatting type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants