0

Have you ever tried working with a XAML file which contains thousand tons of line of code. (More specifically Drawing Brushes for whole application in my case). This file is of 20+ MB size. Whenever i try to add/edit anything in this, Visual Studio 2008 crashes (7/10 times). Then if i'm able to do my changes and try to save change then VS crashes (most of the times). It is so difficult to work with such a big file in VS (same happens in Blend too but with few occurences)
I know having such a big file doesn't come under Good Coding standards. But what should we do if somehow we come in such scenario???

The only thing I finally found was KXAML : which proved quite good. Any other suggestions ??

UPDATED I dont want to change structure of that file or go for any other approach. I'm curious to know how to work / with such file. (other editors may be)

ADD seeing the answers - I would say i'm not stuck at this point i want to know if someone got stuck then is it better way to edit such thing ?? (separating this file would be the v.first thought to avoid this problem not solution)

ADD1 Alright !! My bad, i got too optimistic regarding this thought. Considering canvass, I would ask for the best practice to split this huge file.

Rohit
  • 6,365
  • 14
  • 59
  • 90
  • have you tried splitting the file? Everything need not be defined in the same `xaml`. Some elements like `Style` can be moved to separate files. – Devendra D. Chavan Mar 09 '11 at 13:18
  • Re your `ADD`: In contrast, NOT splitting the file at this point is fighting the symptoms as opposed to targeting the diagnosis. If suffering from an ailment, one would want the docs to and get rid of it, not _only_ supply drugs to relieve the pain. – Grant Thomas Mar 09 '11 at 14:05
  • Got too much offtrack and offhand !! – Rohit Mar 09 '11 at 14:43

4 Answers4

3

I might suggest you take the pro-active approach and see if you can't segment it appropriately.

Define separate ResourceDictionary files to encapsulate reused resources and suchlike; similarly, do this for other sections of the file which can be stripped out and simply referenced.

This way you can have a file containing your Brushes, a file per Style and/or ControlTemplate, and so on and so forth.

EDIT:

As per your update stating quite definitively that you don't want to actually change the file, then I can only reply to the question of 'How to work with such a large file?' with these words:

With great difficulty, pangs of irritated senses and a lot of wasted time.

Grant Thomas
  • 44,454
  • 10
  • 85
  • 129
  • This would be the solution to reduce the size of that file. I want to know how to work with such a file (I dont wish to do anything with the structure of that file) – Rohit Mar 09 '11 at 13:19
  • Then I think you're S.O.O.L. Compensating for someone's incompetence isn't good practice, either - just do things properly, your way, the right way. – Grant Thomas Mar 09 '11 at 13:20
1

I 've had the same problem in VS2010 with some huge xaml files of some old colleagues that hadn't really heard about coding standards. I can assure you that VS2010 crushes a lot too. What I ended up doing was to split the xaml files into several files and then adding them as resources or as merged dictionaries.

P.S. did you mean Kaxaml?

0

Have you thought about splitting the file into separate resource dictionaries files and merging them into a single dictionary?

devdigital
  • 34,151
  • 9
  • 98
  • 120
0

Why it is so large?? All styles for Infragistics controls (brushes, controls styles etc) are less than 10 Mb.
You should to consider to use styles inheritance as frequently as possible. Also you should split this file to few smaller files. It is torture to work with so large file. Try to have all files smaller than for example 1000 lines.

Marek Kwiendacz
  • 9,524
  • 14
  • 48
  • 72