05-16-07 12:15 AM
Wow! Ok...are you ready for this?
I spent a good four hours going through our code, debugging
everything. I checked every posting that used the template that held
the faulty user control. There was nothing wrong with our user control
at all. It just didn't make sense. Finally, I did something I
shouldn't have: I decompiled the assessment tool's AspNetProcessor.dll
and followed through the code. It turns out it was time well spent,
but perhaps a bug in the assessment tool.
It turns out that there is a Parse() method in the
Microsoft.ContentManagement.AssessmentTool.AspNetProcessor.Parser
class that was referencing the character immediately following an HTML
comment. The problem was that this particular ascx file ended with an
HTML comment but no carriage return/line feed after the comment. So
the Parse() method received a null value and threw an exception. I
placed my cursor at the end of the comment in the ascx file, hit
enter, saved it, and re-ran the assessment tool. BINGO. I have
results.
On May 15, 11:41 am, dahazeman <hazyshadeofg...@hotmail.com> wrote:
> I'm trying to run the MCMS Migration Assessment Tool, but I'm getting
> an exception. It only happens when I check the Code Analysis option;
> I've run the tool successfully without analyzing the code, but we
> obviously need to do that step as well. The exception is:
> -------------------------------------------------------------
> While processing c:\<filepath>\<filename>.ascx:
> System.IndexOutOfRangeException: Index was outside the bounds of the
> array.
> atMicrosoft.ContentManagement.AssessmentTool.AspNetProcessor.Parser.As=
pParser=AD.NextChar(Int32
> off)
> at
> Microsoft.ContentManagement.AssessmentTool.AspNetProcessor.Parser.AspPars=
er=AD.ConsumeHtmlComment()
> at
> Microsoft.ContentManagement.AssessmentTool.AspNetProcessor.Parser.AspPars=
er=AD.Parse()
> at
> Microsoft.ContentManagement.AssessmentTool.AspNetProcessor.CodeAnalyzer.A=
na=ADlyzeAscxFile(String
> aspFile, MSILCollector collector, ArrayList processedElements)
>
> Looking at the code for that user control, there are two places where
> an index of any sort is checked:
>
> It is loading the contents of an XmlPlaceholder into an XmlDocument
> object.
> foreach(XmlNode xn in xmlDoc.DocumentElement.ChildNodes) {
> if(xn.InnerText.Length>4) {
> if(xn.InnerText.Substring(0,4)=3D=3D"XXXX") {
> string someString =3D xn.InnerText.Remove(0, 4);
>
> I added the check for the InnerText.Length just today to see if that
> was what caused the exception, but the assessment tool still stops on
> this user control.
>
> There are no other instances of using an index of any sort in this
> code-behind page. Is there something we're missing that might generate
> this exception? Could this be a bug with the assessment tool? There
> are a number of postings created with the template that has this user
> control on it. I've randomly browsed to a few in debug mode, but none
> of them are generating an exception.
>
> Any suggestions will be appreciated.
>
> Thanks,
> Jason
[ Post a follow-up to this message ]
|