Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does C# designer-generated code (like Form1.designer.cs) play havoc with Subversion?

My workshop has recently switched to Subversion from SourceSafe, freeing us from automatic locks. This led to concurrent editing of the Forms, which is wonderful. But when multiple developers commit their changes, the code files created by the designer (all the files named TheFormName.designer.cs) cause conflicts which are very difficult to resolve.

As far as I can tell, this is because the code generated by the designer is heavily re-arranged whenever the user modifies it, no matter how little the actual change really did.

  • How do I make these conflicts easier to resolve?
  • Is there some way to tell the designer to modify the code less?
  • How do you, the experienced C# teams, deal with concurrent modification of a Form?
like image 881
Shalom Craimer Avatar asked Jan 28 '09 06:01

Shalom Craimer


People also ask

Why do we use %d in C?

In C programming language, %d and %i are format specifiers as where %d specifies the type of variable as decimal and %i specifies the type as integer. In usage terms, there is no difference in printf() function output while printing a number using %d or %i but using scanf the difference occurs.

Why do we write in C?

It was mainly developed as a system programming language to write operating system. The main features of C language include low-level access to memory, simple set of keywords, and clean style, these features make C language suitable for system programming like operating system or compiler development.

Why semicolon is used in C?

Role of Semicolon in C: Semicolons are end statements in C. The Semicolon tells that the current statement has been terminated and other statements following are new statements. Usage of Semicolon in C will remove ambiguity and confusion while looking at the code.

Why is C not A or B?

Because C comes after B The reason why the language was named “C” by its creator was that it came after B language. Back then, Bell Labs already had a programming language called “B” at their disposal.


2 Answers

Here are some things to try:

  • Make things more modular. Use components like User Controls etc. to split forms into multiple, smaller physical files.
  • Use presentation layer design patterns like MVP to move code out of views and into standard POCO classes.
  • Recent versions of SVN allow you to take hard locks - use this to avoid complex merge scenarios.

Hope that helps.

like image 92
Andrew Peters Avatar answered Oct 14 '22 15:10

Andrew Peters


I'm pretty sure there is no silver bullet for this problem as the designer stomps all over the designer.cs.

All I can suggest is to minimise the use of the designer. Personally I only hook to events in code and only use the designer only for initialisation and positioning. As such it isn't too hard to fathom differences in a changeset ("oh, someone has added a button", "oh, someone has changed how it looks slightly").

like image 40
Quibblesome Avatar answered Oct 14 '22 16:10

Quibblesome