spreadsheetlab / XLParser

A C# parser for Microsoft Excel formulas with a 99.9% compatibility rate
Other
408 stars 91 forks source link

No classes derived from Irony.Grammar were found in the assembly #93

Closed ArthurAttout closed 4 years ago

ArthurAttout commented 4 years ago

Setup:

Microsoft Visual Studio Community 2019 XLParser at cb76371 Irony V1.1.0 No .NET versions altered for any projects

Steps

Build Irony Build XLParser Execute Irony.GrammarExplorer Click "Add grammar" Choose any of

XLParser\src\XLParser\bin\Debug\net452\XLParser.dll"
XLParser\src\XLParser\bin\Debug\net461\XLParser.dll"
XLParser\src\XLParser\bin\Debug\netstandard1.6\XLParser.dll"
XLParser\src\XLParser\obj\Debug\net452\XLParser.dll"
XLParser\src\XLParser\obj\Debug\net461\XLParser.dll"
XLParser\src\XLParser\obj\Debug\netstandard1.6\XLParser.dll"

(This also happens when building in Release mode for both tools)

Actual behavior

Irony shows an error dialog box :

No classes derived from Irony.Grammar were found in the assembly

Expected behavior

Grammar should load properly


I'm not entirely sure wether this is an Irony or an XLparser issue since I don't really know how to explore DLL files, any help would be welcome !

ArthurAttout commented 4 years ago

Okay, so this was linked to Irony's Nuget package version used by XLParser.

XLParser uses Irony's Nuget v1.0.11 while the last Irony Grammar Explorer builds v1.1.11. So when Irony Grammar Explorer checks for assemblies :

var types = asm.GetTypes();
      var grammars = new GrammarItemList();
      foreach (Type t in types) {
          if (t.IsAbstract) continue;
          if (!t.IsSubclassOf(typeof(Grammar))) continue;
          grammars.Add(new GrammarItem(t, assemblyPath));
      }

The referenced Grammar is v1.1.11 and isn't found in XLParser.dll.

A quick fix is to rebuild XLParser with the last stable version of Irony (it seems to break the tests though haven't looked further), and feed that DLL to the Grammar Explorer.