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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added safety check for StructLayout in CodeReorganizationAvailablityLogic #269

Closed
wants to merge 1 commit into from

Conversation

magoocas
Copy link

@magoocas magoocas commented Apr 8, 2016

Related to issue #239.

Required to prevent re-organization of structs or classes that are meant to be marshalled to a Native function (Order is important).

[StructLayout(LayoutKind.Sequential)]
public struct Example
{
    int var1;
    int var3; //needs to stay above var2
    int var2;
}

@codecadwallader
Copy link
Owner

Thank you for submitting a pull request. We actually already have logic in place to detect the StructLayout attribute and prevent reorganization from running. It happens a little deeper down the stack which allows for you to reorganize a file but a particular member (e.g. a private struct within a class) is the only member that is skipped.

https://github.com/codecadwallader/codemaid/blob/master/CodeMaid/Logic/Reorganizing/CodeReorganizationManager.cs#L221

Are you seeing a scenario where this logic isn't working?

@codecadwallader codecadwallader self-assigned this Apr 9, 2016
@magoocas
Copy link
Author

magoocas commented Apr 9, 2016

Huh, well I'll be. I did have a case (the reason I went looking in the source in the first place) but now I can't seem to replicate it.

Sorry about that, my bad.

That'll teach me for submitting a pull request when I have a cold!

@codecadwallader
Copy link
Owner

No worries. If you stumble back into a scenario feel free to holler or submit a new pull. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants