Max length of code snippet?

C

Clive Dixon

Is there a maximum length for a code snippet? I have created quite a long
one (> 170 lines), which when I use it to generate code, it only generates
around the first 170 lines of the snippet.
 
J

Jon Skeet [C# MVP]

Is there a maximum length for a code snippet? I have created quite a long
one (> 170 lines), which when I use it to generate code, it only generates
around the first 170 lines of the snippet.

Do you really have over 170 lines of code which you need to include
verbatim on a regular basis? I'd get really worried if I started seeing
that much code in multiple places.
 
C

Clive Dixon

Well yes, so would I, but I am having to deal with badly designed legacy
code - my attempts to refactor by 'genericising' can unfortunately only go
so far and there are still large areas where it's frankly easiest to plonk a
large code snippet in when creating a new class for a certain purpose in the
system. Thus far we've had to create by hand... (The classes use an
underlying corresponding set of auto-generated classes which severely limits
the amount of generic code which can be created, and it's far far too risky
to do anything to change that autogenerated code right now, believe me. I
wish I could, but I have to work with what I've got.)

Anyway, found my problem: I had a double $ in the code snippet where there
was a replacement token, which stopped the snippet generation in its tracks.
 
J

Jon Skeet [C# MVP]

Well yes, so would I, but I am having to deal with badly designed legacy
code - my attempts to refactor by 'genericising' can unfortunately only go
so far and there are still large areas where it's frankly easiest to plonk a
large code snippet in when creating a new class for a certain purpose in the
system. Thus far we've had to create by hand... (The classes use an
underlying corresponding set of auto-generated classes which severely limits
the amount of generic code which can be created, and it's far far too risky
to do anything to change that autogenerated code right now, believe me. I
wish I could, but I have to work with what I've got.)

Anyway, found my problem: I had a double $ in the code snippet where there
was a replacement token, which stopped the snippet generation in its
tracks.

Ah, right. Wow, that does sound like a grim situation :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top