Generated by a tool?

[Update: This is a repost of a post I made on Friday 5/6, since the original post was lost due to a problem in the server software. Unfortunately, I don't yet have the comments I received on the original post, but I will reinstate them if/when they are extracted.]  

As I have mentioned in earlier posts, the MSDN Product Feedback Center is a great way for customers to report bugs and suggestions directly to the product teams in Microsoft. I think this has been a great success especially for VS 2005/.NET 2.0 and we have had a steady stream of issues come in.

The issues range from very specific bug reports to creative suggestions about how VS 2005 can help increase developer productivity. Here is a recent suggestion that falls into the latter category:

(quoted from

Problem Statement:  Opened by asaeman on 2005-04-26 at 11:50:42 
Autogenerated code in Visual studio is preceeded by the comment section that includes:
<autogenerated>This code was generated by a tool.</autogenerated>

The word "tool" may be used as an insult, describing someone who is being manipulated without their knowledge - implying they are naive and ignorant. []

I don't mind this showing up in code that others write and in fact when I first saw that phrase I started laughing. "What a tool!, I can't believe he(she) wrote that code - no wonder it doesn't work!!!". However, when it shows up in projects that I'm developing, it's kind of insulting. "Are you calling me a tool?"
Proposed Solution: 

I would change the line: "This code was generated by a tool" to:
1) "This code automagically appeared here" - automagically is a great word.
2) Or for a more serious solution:
"This code was autogenerated" - Maybe move it underneath the runtime version and just above. "Changes to this file may cause incorrect behavior and will be lost if the code is regenerated." so it's not immediately underneath the <autogenerated> tag.
3) Just remove the line - the comment is enclosed in an autogenerated section.

Note: I checked Faster Development below because I develop code faster when I'm not insulted.

I agree - in fact, as one of the developers that works on the code generator/serializer in VS, I think the insult is directed more at me than the user, since in some sense, I feel responsible for the code being referred to. Anyway, the issue is somewhat mitigated in VS 2005 because this generated code is hidden away in a partial class. Hopefully no one will ever look in that file 🙂

Comments (8)

  1. DeepICE says:

    T and F are in close proximity on the keyboard

  2. Frans Bouma says:

    But… reading your last paragraph, you’re not going to change the text? 😉

  3. Peter Ibbotson says:

    Don’t you believe it, I look in the partial classes all the time. Sometimes it’s easier to cut’n’paste rather than mess with the GUI.

    I’ll take the risk that I break the roundtripping stuff but sometimes it’s just so much easier.

  4. heh says:

    Most code is generated by "tools" ie, developers.

  5. rprabhu says:

    Okay – reinstated the comments on the original post manually.

  6. j_tasler says:

    I think the autogenerated comments should include more information. Take a look at what MIDL generates. (remember MIDL?)

    Here are some things that are useful to have in an auto-generated file:

    Generated at 07:36:47am 10/23/2005 PST

    Generated by D:dev.binaries.amd64chktoolsSmartGen.exe -d -f "somepathsomefile.xml"

    The last one includes a lot that could be broken into different lines:

    -path to generator

    -name of generator

    -args used to generate

    -input file to the generator

    One thing I particularly like about the all of that is that it gives me the exact information I may need if I would like to manually regenerate the file, if need be.

    Obviously, the designer-generated files might not be able to provide all of the above info. The point is, though, that just telling me it was autogenerated can be insulting to ME, implying that I’m too much of a tool to need to understand what’s going on in the source file. I usually do need to understand it, and sometimes I’d like to regenerate it.

  7. CodeDummy says:

    When you use either VBCodeProvider or CSharpCodeProvider and generate the code use this method to generate the class: GenerateCodeFromNamespace instead of GenerateCodeFromCompileUnit.

  8. Mike Aleksiuk says:

    I really hope that message never changes.  Both my brother and I got a good laugh when we first ran across that message, and I still enjoy it when I happen to see it while coding.  

    I’d love to know if the person who wrote that line intended on the double meaning.

Skip to main content