title: drools.net Reading DRL file
body: <p>I am trying to run a simple application that uses drool.net. Whenever I execute, the application crashed at <code>builder.AddPackageFromDrl("DroolsApp.Rules.drl", stream);</code> The Error stated that NullReferenceException was unhandled and Object reference not set an instance of an object. I tried to change drl file but the error was still present. Am I missing anything? Also is there any site that provides a detailed tutorial for using drools.net and do I need any specific program to create and edit drl files as I am using a simple notepad.</p>
  
  <p>Thanks in Advance</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using org.drools.dotnet.compiler;
  using org.drools.dotnet.rule;
  using org.drools.dotnet;
  using System.IO;
  using System.Reflection;
  
  namespace DroolsApp
  {
      class Program
      {   
          static void Main(string[] args)
          {            
              PackageBuilder builder = new PackageBuilder();
              Stream stream = Assembly.GetExecutingAssembly()
              .GetManifestResourceStream("DroolsApp.Rules.drl");
              builder.AddPackageFromDrl("DroolsApp.Rules.drl", stream);
              Package pkg = builder.GetPackage();
              RuleBase ruleBase = RuleBaseFactory.NewRuleBase();
              ruleBase.AddPackage(pkg);            
              executeRules(ruleBase, 5);
              executeRules(ruleBase, 6);
              executeRules(ruleBase, 7);
          }
  
          public static void executeRules(RuleBase ruleBase, int amount)
          {
              WorkingMemory workingMemory = ruleBase.NewWorkingMemory();
              Quest quest = new Quest();
              quest.Value = amount;
              workingMemory.assertObject(quest);
              workingMemory.fireAllRules();
          }
      }
  }   
  
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace DroolsApp
  {
      class Quest
      {
          public int Value { set; get; }
      }
  }
  
  DRL File:    
  
  package DroolsApp
  
  rule "NumberFive"
      when
          quest : Quest( Value == 5 )
      then
              Console.WriteLine("FIVE");
  end 
  
  rule "NumberSix"
      when
          quest : Quest( Value == 6 )
      then
              Console.WriteLine("SIX");
  end
  </code></pre>
  
  <p>Stack Trace:</p>
  
  <pre><code>System.NullReferenceException was unhandled
    Message=Object reference not set to an instance of an object.
    Source=drools.dotnet
    StackTrace:
         at org.drools.dotnet.semantics.DotnetClassTypeResolver.resolveType(String className)
         at org.drools.semantics.java.RuleBuilder.build(ColumnDescr columnDescr)
         at org.drools.semantics.java.RuleBuilder.build(RuleDescr ruleDescr)
         at org.drools.semantics.java.RuleBuilder.build(Package pkg, RuleDescr ruleDescr)
         at org.drools.compiler.PackageBuilder.addRule(RuleDescr ruleDescr)
         at org.drools.compiler.PackageBuilder.addPackage(PackageDescr packageDescr)
         at org.drools.compiler.PackageBuilder.addPackageFromDrl(String fileName, Reader reader)
         at org.drools.dotnet.compiler.PackageBuilder.AddPackageFromDrl(String fileName, Stream drlStream)
         at MinimalDroolsForm.Program.Main(String[] args) in C:\Users\Carl\Desktop\DroolsApp\Program.cs:line 19
         at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
         at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()
    InnerException: 
  </code></pre>