Ajaxmin Tasks crashes when Switches="-kill:-1" is used

Oct 31, 2012 at 10:49 PM

Per the discussion at http://ajaxmin.codeplex.com/discussions/360291, I would like to use JsCombinedFileName. However, I discovered a bug. If I use the following:

  <Target Name="CleanCombineAndMinify" Condition=" '$(Configuration)' == 'Debug' ">
    <AjaxMin Switches="-kill:-1" JsSourceFiles="js\1.js" JsCombinedFileName="Testing.js" />
  </Target>

The code crashes with the following exception tree:

my.csproj(189,5): error : Did not minify to destination file 'Testing.js': Object reference not set to an instance of an object.
my.csproj(189,5): error MSB4018: The "AjaxMin" task failed unexpectedly.\r
my.csproj(189,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Utilities.ActivationObject.AnalyzeScope()\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Utilities.ActivationObject.AnalyzeScope()\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Utilities.ActivationObject.AnalyzeScope()\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Utilities.ActivationObject.AnalyzeScope()\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Utilities.JSParser.Parse(CodeSettings settings)\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Utilities.Minifier.MinifyJavaScript(String source, CodeSettings codeSettings)\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Minifier.Tasks.AjaxMin.MinifyJavaScript(String sourceCode, String sourceName, String outputPath, String mapFilePath)\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Minifier.Tasks.AjaxMin.ConcatenateAndMinifyJavaScript(String mapFilePath)\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Minifier.Tasks.AjaxMin.MinifyJavaScript()\r
my.csproj(189,5): error MSB4018:    at Microsoft.Ajax.Minifier.Tasks.AjaxMin.Execute()\r
my.csproj(189,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r
my.csproj(189,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()

If you don't specify the Switches parameter or even if you simply use Switches="-clobber" it works fine.

 <Target Name="CleanCombineAndMinify" Condition=" '$(Configuration)' == 'Debug' ">
    <AjaxMin Switches="-clobber" JsSourceFiles="js\1.js" JsCombinedFileName="Testing.js" />
  </Target>

Oct 31, 2012 at 11:01 PM

I just realized that this is a bug, not a discussion topic. I created an Issue.

Coordinator
Nov 11, 2012 at 10:36 PM

Give 4.74 as try. I think I fixed the problem.