Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep getting partial declarations accessibillity method errors

Tags:

c#

I have downloaded some code from my friend (we are working together on it) when I run the code a few times, it runs fine with no errors, then later when I go to run it, I keep getting these 2 errors:

Error 1 Partial declarations of 'GuiGame.HareAndTortoiseForm' have conflicting accessibility modifiers

public partial class HareAndTortoiseForm : Form {

Error 2 Missing partial modifier on declaration of type 'GuiGame.HareAndTortoiseForm'; another partial declaration of this type exists

internal class HareAndTortoiseForm {

I think the code was generated automatically when I created the GUI form. I have tried changing the accessors so they are both public partial, but still no luck. I have tried re-downloading the file about 10 times and keep having the problem, I cannot find out where it is coming from or how to fix it. Does anyone have any clue? The top line of code is from the HareAndTortoiseForm.cs class and the other line is from the HareAndTortoiseForm1.Designer.cs class.

like image 588
user2443245 Avatar asked Jun 01 '13 13:06

user2443245


1 Answers

So long as the two match, it should be fine. If they're really both public, it will work... but I suspect you're modifying the code owned by the designer... which is then regenerating it to be internal.

If you want it to be public, go to the form designer and change the accessibility there to Public, at which point it should be fine.

If you want it to be internal, change your "manual" code file and just fix it there.

So long as it's consistent between the source files and the designer doesn't then overwrite the source with something conflicting, all should be well.

like image 167
Jon Skeet Avatar answered Oct 12 '22 22:10

Jon Skeet