This project is read-only.

LINQPad unknown metadata format


I created a custom parser to handle the log format that my application outputs. I wanted to be able to view the logs in LINQPad. When it attempts to load the connection, it fails with an 'unknown metadata format' exception. I looked through the code a bit and found where the exception is thrown in TypeCache.BuildCache method. If I change the file extension to evtx, which just breaks out of the switch statement, and update my FileParser attribute to accept it, the log file loads just fine. Should it just break out for files that are known (through the FileParser attribute) but not handled by that switch statement? Or should it not concat the metadata files with the source files?


renoRanger wrote Jan 8, 2014 at 7:12 PM

Hi, I kinda have a similar issue. Id like to parse some log files that are in the .txt format.

I couldnt quite figure out how to create my own parse format. Id like to know how to.

Anyway, it would be awesome if I can simply specify a parse format and then perform LINQ queries on it!


georgis wrote Jan 28, 2014 at 10:38 PM

The Tx extensibility with new formats works ok if you are using just the NuGet packages. The LinqPad driver code is not yet there - I have switch statement only for the few supported types.

To smbecker's problem:

Evtx is the format for Windows Event Logs. The actual content is binary XML. If your application generates something else, changing the extension won't help. Essentially, if EventVwr can read the file so should Tx.

Here is a workaround:

I will illustrate with IIS text logs in W3C format as example of simple text
  • start from any of the Tx samples, and create empty query with the same properties
  • type this:
var iisTrace = W3CEnumerable.FromFile(@"c:\git\tx\Traces\u_ex130609.log");
var table = from r in iisTrace select new {r.dateTime, r.cs_uri_stem};
This does not go through the file-open path usual for Tx. Instead it creates parser object and reads hard-coded file.

Similarly, you can create a parser for the application's text format and instantiate it like this.
This will be using LinqPad without Tx

See also When to use Tx