Error when using after published to server

Oct 22, 2009 at 12:05 AM

I'm getting the following error when I try to use this on our staging server.  This error does NOT get thrown locally on my machine.  I've tried changing the datatype from Short, Integer, Long.


The line of code that is erroring is:

oTempProducts.Sort("Audience, Category, Sort") 'String, String, Integer




Method 'Int32 CompareTo(Int32)' is not defined for type 'System.Int32


Dynamite.Parsing.ParserException: Method 'Int32 CompareTo(Int32)' is not defined for type 'System.Int32'
     at Dynamite.ComparerBuilder`1.GetFieldComparisons(String sortExpression) in C:\Users\apatel\Desktop\Dynamite_1_0_1\Dynamite\ComparerBuilder.cs:line 1087
     at Dynamite.ComparerBuilder`1.CreateTypeComparison(String sortExpression) in C:\Users\apatel\Desktop\Dynamite_1_0_1\Dynamite\ComparerBuilder.cs:line 509
     at Dynamite.Extensions.ComparerExtensions.Sort[T](List`1 list, String sortExpression) in C:\Users\apatel\Desktop\Dynamite_1_0_1\Dynamite\ComparerExtensions.cs:line 44
     at Objects.MarketingGuide.UpdateProductsSortFromValues() in C:\Users\apatel\Documents\My Projects\JacksonNational\Superfulfillment\Website\App_Code\Objects\MarketingGuide.vb:line 882'

Oct 22, 2009 at 12:32 AM

Temporary fix was to create a new property called "SortText" where it returns a zero-filled string, instead of an INT.  And no more error.

Oct 25, 2009 at 1:12 PM


Since you just get the error on the staging server you probably have a different version of the .NET framework there. I have only tested it on 3.5 SP1, it is likely that you miss Service Pack 1 on your server.

If you can't upgrade to .NET 3.5 SP1 on the server, you could try the following change in ComparerBuilder.cs line 831:

// Try typed CompareTo (defined in IComparable<T> generic interface type) first.
MethodInfo compareToMethod = null;
Type genericIComparableType = typeof(IComparable<>).MakeGenericType(propType);
if (genericIComparableType.IsAssignableFrom(propType))
compareToMethod = genericIComparableType.GetMethod("CompareTo");
compareToMethod = GetMethodImplementation(propType, compareToMethod);
Good luck.