for each looping getting out of scope exception MVC <p>am facing a strange issue. </p> <p>Am looping a list object. The list contain 18 object. The loop running 18 times but the end of the 18th one getting <strong>Object reference not set to an instance of an object.</strong>.</p> <pre><code> @For Each Slogs As SFAMobile.MobileServices.CustomerDetail In Model.Customers @&lt;option value='@Slogs.CustomerId' @selectedVal &gt;@Slogs.Name ( @Slogs.CustomerId ) &lt;/option&gt; Next </code></pre> <p>please help me to fix this issue </p> <p>Thanks in Advance Ramesh R C </p>