Strange problem

Feb 9, 2009 at 8:44 PM
I am getting the following error while building:
error : Failed to read in the data for the path/file [.\TempBuildDir\Scripts\Common\Test.js].
The most common cause for this is because the path is incorrect or the file name is incorrect ... so please check your path and file names.
Until you fix this up, I can't continue ... sowwy.
error : Index was out of range. Must be non-negative and less than the size of the collection.\r
error : Parameter name: startIndex

This only happens when have one of my js files has the contents below. I can't seem to work it out. I have a bunch of other .js files which work just fine but the below fails with the error above. Anyone have any ideas?

controls.SearchCombo = Ext.extend(Ext.form.ComboBox,{
    forceSelection: true,
    loadingText: 'Searching...',
    minChars: 3,
    mode: 'remote',
    msgTarget: 'side',
    queryDelay: 300,
    queryParam: 'q',
    selectOnFocus: true,
    typeAhead: false
});


Coordinator
Feb 9, 2009 at 9:29 PM
Hi Nabils,
  thanks for the interest in the project. So I can setup up my test cases to replicate your scenario, are you saying that the javascript (above) is -all- the content found in a single .js page? Or is that some partial content from a much larger, single .js page? if it's the later, can u please post the FULL .js page, or at least a link to it so i can download it and use that file as a reference for some new unit tests.

thanks mate :)
Feb 10, 2009 at 9:02 AM
Thanks for the quick response. Yes it is the only code in the file test.js. I tried to compress it with YahooUI (the orginal java version) and it worked fine with encoding set to UTF8. Would rather use your msbuild task with no dependency on java though? If you need anything else let me know.
Feb 11, 2009 at 5:39 PM
I have the exact same issue with some of the javascript files in my solution.

Using the CompressorTask on the javascript files from the AjaxControlToolkit also throws the same error for most of them.
Try this one as an example: http://www.codeplex.com/AjaxControlToolkit/SourceControl/changeset/view/46478#7051

The original java compressor is able to compress this file without errors.
Coordinator
Feb 11, 2009 at 9:29 PM
thanks heaps Nameetpai for the bug report. I'll keep trying to find some time to keep debugging this problem :( I'll added the AjaxControlToolkit to the unit test cases also.

Don't be afraid to download the code and help :)
Mar 3, 2009 at 12:46 AM
I had this same problem. I made sure i had my encoding correctly for the files i was minifying and added ThreadCulture. Im not sure which one did the trick but all is working now. If you still have issues i would play around with the other attributes like ObfuscateJavaScript="False"

    <CreateItem Include="$(AppTargetPath)\**\*.js" Exclude="$(AppTargetPath)\**\*-min.js;$(AppTargetPath)\js\yui\**\*.js">
      <Output TaskParameter="Include" ItemName="JavaScriptFiles" />
    </CreateItem>
    <CreateItem Include="$(AppTargetPath)\**\*.css" Exclude="$(AppTargetPath)\js\yui\**\*.css">
      <Output TaskParameter="Include" ItemName="CssFiles" />
    </CreateItem>
    <!--
            CssFiles/JavaScriptFiles data format: can be delimeted by a space, comma or semicolon. having an extra space after the delimeter is optional also.
                      Valid examples:
                         o) StylesheetSample1.css, StylesheetSample2.css
                         o) StylesheetSample1.css,StylesheetSample2.css
                         o) SampleJavaScript1.js;SampleJavaScript2.js
                         o) SampleJavaScript1.js     SampleJavaScript2.js
            DeleteCssFiles: [Optional] True | Yes | Yeah | Yep | True | FoSho | Fo Sho. Default is False. Anything else is False. (eg. blah = false, xxxx111 = false, etc)
            CssCompressionType: YuiStockCompression | MichaelAshsRegexEnhancements | HaveMyCakeAndEatIt or BestOfBothWorlds or Hybrid; Default is YuiStockCompression.
            ObfuscateJavaScript: [Optional] refer to DeleteCssFiles, above.
            PreserveAllSemicolons: [Optional] refer to DeleteCssFiles, above.
            DisableOptimizations: [Optional] refer to DeleteCssFiles, above.
            EncodingType: [Optional] ASCII, BigEndianUnicode, Unicode, UTF32, UTF7, UTF8, Default. Default is 'Default'.
            DeleteJavaScriptFiles: [Optional] refer to DeleteCssFiles, above.
            LineBreakPosition: [Optional] the position where a line feed is appened when the next semicolon is reached. Default is -1 (never add a line break).
                               0 (zero) means add a line break after every semicolon. (This might help with debugging troublesome files).          
            LoggingType: None | ALittleBit | HardcoreBringItOn;  Hardcore also lists javascript verbose warnings, if there are any (and there usually is :P ).
            ThreadCulture: [Optional] the culture you want the thread to run under. Default is 'en-gb'.
        -->

    <CompressorTask
       Condition="'%(JavaScriptFiles.Identity)' != ''"
       JavaScriptFiles="%(JavaScriptFiles.Identity)"
       ObfuscateJavaScript="True"
       PreserveAllSemicolons="True"
       DisableOptimizations="True"
       EncodingType="UTF8"
       DeleteJavaScriptFiles="False"
       JavaScriptOutputFile="%(JavaScriptFiles.Identity)"
       LoggingType="ALittleBit"
       ThreadCulture="en-us"/>
    <CompressorTask
       Condition="'%(CssFiles.Identity)' != ''"
       CssFiles="%(CssFiles.Identity)"
       DeleteCssFiles="False"
       CssOutputFile="%(CssFiles.Identity)"
       CssCompressionType="YuiStockCompression"
       EncodingType="Default"
       LoggingType="ALittleBit" />
Coordinator
Mar 3, 2009 at 1:17 AM
Edited Mar 3, 2009 at 1:18 AM
The current version* works perfectly fine with this sample code.

this is the result:-

controls.SearchCombo=Ext.extend(Ext.form.ComboBox,{forceSelection:true,loadingText:"Searching...",minChars:3,mode:"remote",msgTarget:"side",queryDelay:300,queryParam:"q",selectOnFocus:true,typeAhead:false});

so download the latest version and give that a go and tell me what if u have any luck, please :)

* Version 1.3.0.0, which was uploaded on Feb 22nd 09.
May 8, 2009 at 1:43 PM

I had the same problem. ThreadCulture="en.us" did the trick for me. Apparently "en-GB" doesn't work in Denmark!?