MonthJanuary 2018

The variable ‘ex’ is declared but never used. How to suppress this error?

[code language=”csharp”]
catch (OutOfMemoryException ex)
{
Log.Error("Error")
}
[/code]
Severity Code Description Project File Line Suppression State
Error CS0168 The variable ‘ex’ is declared but never used

To suppress this code remove variable and simply write catch block like this-
[code language=”csharp”]
catch (OutOfMemoryException)
{
Log.Error("Error")
}
[/code]

Sitecore LiveMode.config

Sitecore Live Mode allows to run the site on content database i.e. master db rather then a web database or published content. This is useful for developers who tend to test the code without publishing Sitecore items every time it is changes in dev or local machine.

Live mode can be set in 2 ways-

  • Directly changing in Sitecore.config or config where Site settings are patched. Set your site database element value to master.
  • ¬†Set the LiveMode.config in /App_Config/Include folder

To setup the Sitecore.config, update following-

[code language=”xml”]
<sitecore>
<sites>
<site name="yoursitename" databasename="master" …></site>
</sites>
</sitecore>
[/code]

To setup LiveMode.config, update following-

[code language=”xml”]
<sitecore>
<sites>
<site name="yoursitename">
<patch:attribute name="database">master</patch:attribute>
<patch:attribute name="filterItems">true</patch:attribute>
<patch:attribute name="enableWorkflow">true</patch:attribute>
</site>
</sites>
</sitecore>
[/code]

database attribute to master for you site.

filteritems is set to true which means that items which has publishing restrictions will be filtered out. This is recommended to be true.

enableWorkflow – set this to false if the items that are in workflow and if you want to be seen in live mode.

 

© 2021 Sandeep Pote

Theme by Anders NorénUp ↑