Hi Denis,

We earlier had a chat about the new Mapping feature of DataObjects.net. We discovered a bug in the domain build routine that did not do correct testing for null values when a defaultschema was set for the domain that was not available in the database.

We set up the web.config correctly and the defaultschema is present in the DB. Now a weird thing is happening on some computers (mind you not on all computers we use). On my local system everything is shiny and running good but on the system of colleague of mine we get a null reference exception I can not explain. Below is the stacktrace and web.config. When we change the 'PerformSafely' to 'Skip' the application runs fine.

Regards Paul

<configuration>
  <configSections>
    <section name="Xtensive.Orm" type="Xtensive.Orm.Configuration.Elements.ConfigurationSection, Xtensive.Orm"/>
    <!--<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />-->
  </configSections>
  <Xtensive.Orm>
    <domains>
      <!-- The PerformSafely attribute below can be overwritten in the DataContext.OpenSession() -->
      <domain name="Default" defaultSchema="DataObjects" provider="sqlserver" connectionString="Data Source=localhost;Initial Catalog=Controlit_Facturatie;Persist Security Info=True;Integrated Security=True;MultipleActiveResultSets=True" upgradeMode="PerformSafely">
        <mappingRules>
          <rule namespace="Projecten.Model.Entities" schema="Projecten"/>
          <rule namespace="Fortrus.Reporting.Model.Entities" schema="Reporting"/>
        </mappingRules>
        <types>
          <add assembly="Fortrus.Reporting.Model"/>
          <add assembly="Projecten.Model"/>
          <!--<add assembly="Xtensive.Orm.Security"/>-->
        </types>
        <sessions>
          <!-- AllowSwitching is nodig voor Telerik Reporting om Session switching toe te staan 
               Telerik werkt nl. met worker threads en dat veroorzaakt een exception wanneer deze
               optie niet aan staat -->
          <session name="default" options="ServerProfile"/>
        </sessions>
      </domain>
    </domains>
  </Xtensive.Orm>

 [NullReferenceException: Object reference not set to an instance of an object.]
   Xtensive.Orm.Web.SessionManager.EnsureDomainIsBuilt() +111
   Xtensive.Orm.Web.SessionManager.ProvideSession() +37
   Xtensive.Orm.Web.SessionManager.EnsureSessionIsProvided() +120
   Xtensive.Orm.Web.SessionManager.<EnsureDomainIsBuilt>b__7() +19
   Xtensive.Orm.Session.get_Current() +47
   Xtensive.Orm.Session.Demand() +9
   Projecten.Model.Entities.OpdrachtgeverEntity.SynchronizeOpdrachtgeversWithCit() in c:\NotScanned\Ontwikkeling\ControlIT\trunk\Projecten.Model\Entities\OpdrachtgeverEntity.cs:169
   Projecten.Viewmodel.VMOpdrachtgeverEntity.SynchronizeOpdrachtgeversWithCit() in c:\NotScanned\Ontwikkeling\ControlIT\trunk\Projecten.Viewmodel\VMOpdrachtgeverEntity.cs:14
   Projecten.WebApplication.MvcApplication.MvcApplicationBeginRequest(Object sender, EventArgs e) in c:\NotScanned\Ontwikkeling\ControlIT\trunk\Projecten.WebApplication\Global.asax.cs:86
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronou

asked May 18 '13 at 00:57

Paul%20Sinnema's gravatar image

Paul Sinnema
261878896

edited May 18 '13 at 00:59

Hi Denis,

This is still an issue for us. After some changes to the Model we have to 'Recreate' the DB in order for it to start working again. The Build() with 'Perform' succeeds successfully but on the next Session.Demand() we still get the NullReferenceException.

(May 30 '13 at 04:13) Paul Sinnema Paul%20Sinnema's gravatar image
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA