示例#1
0
 protected void OnAssemblyScanned(AssemblyScannedEventArgs e)
 {
     if (AssemblyScanned != null)
     {
         AssemblyScanned(this, e);
     }
 }
示例#2
0
        public void WriteAssembly(AssemblyScannedEventArgs e)
        {
            WriteTableRow(e.AssemblyName, e.AssemblyVersion.ToString(), e.MissingMethodResults.Count, e.NotImplementedExceptionResults.Count, e.MonoTodoResults.Count, e.PInvokeResults.Count);

            if (e.TotalIssues > 0)
            {
                BeginSubRow();
            }

            if (e.MissingMethodResults.Count > 0)
            {
                WriteSubRowHeader("Calling Method", "Method Missing from Mono", string.Empty);

                foreach (MomaError b in e.MissingMethodResults)
                {
                    WriteSubRowContent(HttpUtility.HtmlEncode(b.GetCaller().ToString()), HttpUtility.HtmlEncode(b.GetCallee().ToStringWithClass()), string.Empty);
                }
            }

            if (e.NotImplementedExceptionResults.Count > 0)
            {
                WriteSubRowHeader("Calling Method", "Method that Throws NotImplementedException", string.Empty);

                foreach (MomaError b in e.NotImplementedExceptionResults)
                {
                    WriteSubRowContent(HttpUtility.HtmlEncode(b.GetCaller().ToString()), HttpUtility.HtmlEncode(b.GetCallee().ToStringWithClass()), string.Empty);
                }
            }

            if (e.MonoTodoResults.Count > 0)
            {
                WriteSubRowHeader("Calling Method", "Method with [MonoTodo]", "Reason");

                foreach (MomaError b in e.MonoTodoResults)
                {
                    WriteSubRowContent(HttpUtility.HtmlEncode(b.GetCaller().ToString()), HttpUtility.HtmlEncode(b.GetCallee().ToStringWithClass()), b.GetCallee().Data);
                }
            }

            if (e.PInvokeResults.Count > 0)
            {
                WriteSubRowHeader("Calling Method", "P/Invoke Method", "P/Invoke Library");

                foreach (MomaError b in e.PInvokeResults)
                {
                    WriteSubRowContent(HttpUtility.HtmlEncode(b.GetCaller().ToString()), HttpUtility.HtmlEncode(b.GetCallee().ToStringWithClass()), b.GetCallee().Data);
                }
            }

            if (e.TotalIssues > 0)
            {
                EndSubRow();
            }
        }
示例#3
0
        public ScanningCompletedEventArgs Analyze()
        {
            if (write_html_report && string.IsNullOrEmpty(html_report_path))
            {
                throw new InvalidOperationException("WriteHtmlReport is true but HtmlReportPath is not set.");
            }
            if (write_xml_report && string.IsNullOrEmpty(xml_report_path))
            {
                throw new InvalidOperationException("WriteXmlReport is true but XmlReportPath is not set.");
            }

            // Reset our totals count
            todo_total = 0;
            niex_total = 0;
            miss_total = 0;
            pinv_total = 0;

            BeginReports();

            // We have to do this first, so we can find methods that
            // call pinvoke methods in the next step.
            foreach (string assem in assemblies)
            {
                ScanAssemblyForPInvokes(assem);
            }

            // Scan each assembly for issues, raise event with results
            foreach (string assem in assemblies)
            {
                AnalyzeAssembly(assem);

                todo_total += mono_todo_results.Count;
                niex_total += not_implemented_results.Count;
                miss_total += missing_results.Count;
                pinv_total += pinvoke_results.Count;

                AssemblyScannedEventArgs asea = new AssemblyScannedEventArgs(assem, AssemblyRuntime, assembly_version, mono_todo_results, not_implemented_results, missing_results, pinvoke_results);
                OnAssemblyScanned(asea);
                AddAssemblyToReport(asea);

                mono_todo_results.Clear();
                not_implemented_results.Clear();
                missing_results.Clear();
                pinvoke_results.Clear();
            }

            // All done!
            ScanningCompletedEventArgs scea = new ScanningCompletedEventArgs(assemblies.Count, todo_total, niex_total, miss_total, pinv_total);

            OnScanningCompleted(scea);
            FinishReports(scea);

            return(scea);
        }
示例#4
0
        private void AddAssemblyToReport(AssemblyScannedEventArgs e)
        {
            if (write_html_report)
            {
                r.WriteAssembly(e);
            }

            if (write_xml_report)
            {
                xr.WriteAssembly(e);
            }
        }
示例#5
0
        public void WriteAssembly(AssemblyScannedEventArgs e)
        {
            WriteTableRow (e.AssemblyName, e.AssemblyVersion.ToString (), e.MissingMethodResults.Count, e.NotImplementedExceptionResults.Count, e.MonoTodoResults.Count, e.PInvokeResults.Count);

            if (e.TotalIssues > 0)
                BeginSubRow ();

            if (e.MissingMethodResults.Count > 0) {
                WriteSubRowHeader ("Calling Method", "Method Missing from Mono", string.Empty);

                foreach (MomaError b in e.MissingMethodResults)
                    WriteSubRowContent (b.GetCaller ().ToString (), b.GetCallee ().ToStringWithClass (), string.Empty);
            }

            if (e.NotImplementedExceptionResults.Count > 0) {
                WriteSubRowHeader ("Calling Method", "Method that Throws NotImplementedException", string.Empty);

                foreach (MomaError b in e.NotImplementedExceptionResults)
                    WriteSubRowContent (b.GetCaller ().ToString (), b.GetCallee ().ToStringWithClass (), string.Empty);
            }

            if (e.MonoTodoResults.Count > 0) {
                WriteSubRowHeader ("Calling Method", "Method with [MonoTodo]", "Reason");

                foreach (MomaError b in e.MonoTodoResults)
                    WriteSubRowContent (b.GetCaller ().ToString (), b.GetCallee ().ToStringWithClass (), b.GetCallee ().Data);
            }

            if (e.PInvokeResults.Count > 0) {
                WriteSubRowHeader ("Calling Method", "P/Invoke Method", "P/Invoke Library");

                foreach (MomaError b in e.PInvokeResults)
                    WriteSubRowContent (b.GetCaller ().ToString (), b.GetCallee ().ToStringWithClass (), b.GetCallee ().Data);
            }

            if (e.TotalIssues > 0)
                EndSubRow ();
        }
示例#6
0
        public void WriteAssembly(AssemblyScannedEventArgs e)
        {
            xml.WriteStartElement ("assembly");

            xml.WriteAttributeString ("name", e.AssemblyName);
            xml.WriteAttributeString ("version", e.AssemblyVersion.ToString ());
            xml.WriteAttributeString ("runtime", e.AssemblyRuntime);
            xml.WriteAttributeString ("todo", e.MonoTodoResults.Count.ToString ());
            xml.WriteAttributeString ("niex", e.NotImplementedExceptionResults.Count.ToString ());
            xml.WriteAttributeString ("miss", e.MissingMethodResults.Count.ToString ());
            xml.WriteAttributeString ("pinv", e.PInvokeResults.Count.ToString ());

            // Write MonoTodo <issue>'s
            foreach (MomaError er in e.MonoTodoResults) {
                xml.WriteStartElement ("issue");
                xml.WriteAttributeString ("type", "todo");
                xml.WriteElementString ("class", er.GetCaller ().ClassOnly);
                xml.WriteElementString ("caller", er.GetCaller ().ToString ());
                xml.WriteElementString ("method", er.GetCallee ().ToString ());
                xml.WriteElementString ("raw", er.GetCallee ().RawMethod);
                xml.WriteElementString ("data", er.GetCallee ().Data);
                xml.WriteEndElement ();
            }

            // Write NIEX <issue>'s
            foreach (MomaError er in e.NotImplementedExceptionResults) {
                xml.WriteStartElement ("issue");
                xml.WriteAttributeString ("type", "niex");
                xml.WriteElementString ("class", er.GetCaller ().ClassOnly);
                xml.WriteElementString ("caller", er.GetCaller ().ToString ());
                xml.WriteElementString ("method", er.GetCallee ().ToString ());
                xml.WriteElementString ("raw", er.GetCallee ().RawMethod);
                xml.WriteEndElement ();
            }

            // Write Missing <issue>'s
            foreach (MomaError er in e.MissingMethodResults) {
                xml.WriteStartElement ("issue");
                xml.WriteAttributeString ("type", "miss");
                xml.WriteElementString ("class", er.GetCaller ().ClassOnly);
                xml.WriteElementString ("caller", er.GetCaller ().ToString ());
                xml.WriteElementString ("method", er.GetCallee ().ToString ());
                xml.WriteElementString ("raw", er.GetCallee ().RawMethod);
                xml.WriteEndElement ();
            }

            // Write P/Invoke <issue>'s
            foreach (MomaError er in e.PInvokeResults) {
                xml.WriteStartElement ("issue");
                xml.WriteAttributeString ("type", "pinv");
                xml.WriteElementString ("class", er.GetCaller ().ClassOnly);
                xml.WriteElementString ("caller", er.GetCaller ().ToString ());
                xml.WriteElementString ("method", er.GetCallee ().ToString ());
                xml.WriteElementString ("raw", er.GetCallee ().RawMethod);
                xml.WriteElementString ("data", er.GetCallee ().Data);
                xml.WriteEndElement ();
            }

            xml.WriteEndElement ();		// assembly
        }
示例#7
0
        public void WriteAssembly(AssemblyScannedEventArgs e)
        {
            xml.WriteStartElement("assembly");

            xml.WriteAttributeString("name", e.AssemblyName);
            xml.WriteAttributeString("version", e.AssemblyVersion.ToString());
            xml.WriteAttributeString("runtime", e.AssemblyRuntime);
            xml.WriteAttributeString("todo", e.MonoTodoResults.Count.ToString());
            xml.WriteAttributeString("niex", e.NotImplementedExceptionResults.Count.ToString());
            xml.WriteAttributeString("miss", e.MissingMethodResults.Count.ToString());
            xml.WriteAttributeString("pinv", e.PInvokeResults.Count.ToString());

            // Write MonoTodo <issue>'s
            foreach (MomaError er in e.MonoTodoResults)
            {
                xml.WriteStartElement("issue");
                xml.WriteAttributeString("type", "todo");
                xml.WriteElementString("class", er.GetCaller().ClassOnly);
                xml.WriteElementString("caller", er.GetCaller().ToString());
                xml.WriteElementString("method", er.GetCallee().ToString());
                xml.WriteElementString("raw", er.GetCallee().RawMethod);
                xml.WriteElementString("data", er.GetCallee().Data);
                xml.WriteEndElement();
            }

            // Write NIEX <issue>'s
            foreach (MomaError er in e.NotImplementedExceptionResults)
            {
                xml.WriteStartElement("issue");
                xml.WriteAttributeString("type", "niex");
                xml.WriteElementString("class", er.GetCaller().ClassOnly);
                xml.WriteElementString("caller", er.GetCaller().ToString());
                xml.WriteElementString("method", er.GetCallee().ToString());
                xml.WriteElementString("raw", er.GetCallee().RawMethod);
                xml.WriteEndElement();
            }

            // Write Missing <issue>'s
            foreach (MomaError er in e.MissingMethodResults)
            {
                xml.WriteStartElement("issue");
                xml.WriteAttributeString("type", "miss");
                xml.WriteElementString("class", er.GetCaller().ClassOnly);
                xml.WriteElementString("caller", er.GetCaller().ToString());
                xml.WriteElementString("method", er.GetCallee().ToString());
                xml.WriteElementString("raw", er.GetCallee().RawMethod);
                xml.WriteEndElement();
            }

            // Write P/Invoke <issue>'s
            foreach (MomaError er in e.PInvokeResults)
            {
                xml.WriteStartElement("issue");
                xml.WriteAttributeString("type", "pinv");
                xml.WriteElementString("class", er.GetCaller().ClassOnly);
                xml.WriteElementString("caller", er.GetCaller().ToString());
                xml.WriteElementString("method", er.GetCallee().ToString());
                xml.WriteElementString("raw", er.GetCallee().RawMethod);
                xml.WriteElementString("data", er.GetCallee().Data);
                xml.WriteEndElement();
            }

            xml.WriteEndElement();                      // assembly
        }