Skip to content

System.InvalidOperationException : Stack is null or empty. #220

@aleks2910

Description

@aleks2910

System.InvalidOperationException : Stack is null or empty.

Steps to reproduce:

 using (var db = new Db("master"))
{
   //  HttpContext.Current  have to be null yet
    db.Configuration.Settings["someKey"] = "someValue";  
 
   HttpContext.Current = new SomeFakeContext(); 
  
   db.Configuration.Settings["someKey"] = "someValue"; //  I think any key and value  behave the same
} // exception is here - in the  Dispose

Stack Trace:

 Switcher`2.Exit()
        Switcher`2.Dispose()
        Settings.Dispose()
        DbConfiguration.Dispose()
        Db.Dispose(Boolean disposing)
        Db.Dispose()

Sitecore.Kernel 10.1.1

Workaround:
set HttpContext.Current before using db.Configuration.Settings!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions