You have no items in your shopping cart.

Friday, November 22, 2024 2:27:59 AM

3.3 to 3.4 upgrade problem

Posted: 10 years ago

#220 Quote

steve@sitesee.net

Posted: 10 years ago

#220 Quote
Hello-

I created a new installation of 3.40 nopcommerce and installed the updated articles plugin. When I first restarted my site, I got this error in the Windows application log:

[code]Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 7/28/2014 1:16:10 AM
Event time (UTC): 7/28/2014 8:16:10 AM
Event ID: 6af103f79a1642b19a0ee46090c49dd5
Event sequence: 4
Event occurrence: 1
Event detail code: 0

Application information:
    Application domain: /LM/W3SVC/11/ROOT-1-130510088527885000
    Trust level: Full
    Application Virtual Path: /
    Application Path: C:\inetpub\wwwroot\MFS_DEV_3point4\
    Machine name: WIN-DDE4FB9847H

Process information:
    Process ID: 5564
    Process name: w3wp.exe
    Account name: IIS APPPOOL\MFS_DEV

Exception information:
    Exception type: HttpException
    Exception message: There is already an object named 'FNS_Article_GetRelatedArticlesByProductId' in the database.
-------------------------------------

..now get error when viewing /articles:

Index and count must refer to a location within the string. Parameter name: count
System.ArgumentOutOfRangeException: Index and count must refer to a location within the string. Parameter name: count at System.String.RemoveInternal(Int32 startIndex, Int32 count) at ASP._Page_Plugins_FoxNetSoft_Articles_Views_ArticleRead_List_cshtml.Execute() in c:\inetpub\wwwroot\MFS_DEV_3point4\Plugins\FoxNetSoft.Articles\Views\ArticleRead\List.cshtml:line 97 at System.Web.WebPages.WebPageBase.ExecutePageHierarc

.... so I tried restarting the application again, but still http://64.239.149.226/articles  will not load...same error.

How can I fix this?

Thanks,
Steve

Posted: 10 years ago

#221 Quote

steve@sitesee.net

Posted: 10 years ago

#221 Quote
Well...nevermind...the page loads now...the initial error must have not been critical...

Posted: 10 years ago

#222 Quote

steve@sitesee.net

Posted: 10 years ago

#222 Quote
Since the problem I am now having is related to upgrading, I will just continue on this thread:

On the /Views/ArticleRead/List.cshtml, I have custom code to manipulate the description string data. It worked fine on 3.3, but for some reason, now I have errors. My code:

<div class="description">
   @{
    string strbody = item.ShortBody;
    string group = Model.ArticleGroupName;
    var thestrbody = " ";

    if (group.Contains("Spacial Orientation")||group.Contains("Topography")||group.Contains("Osteology")||group.Contains("Angiology")||group.Contains("Neurology")||group.Contains("Myology")||group.Contains("Radiology")||group.Contains("Misc. Drawings")||group.Contains("Clinical Testing"))
        {
        thestrbody = strbody;
        }
    else
        {
        string s = item.ShortBody;
        string sLess = s.Remove(0, 12);
        int index = sLess.IndexOf("Summary");
        thestrbody = (sLess.Substring(index + 8));
        }
    }
   @thestrbody
    
       @if (group.Contains("Spacial Orientation")||group.Contains("Topography")||group.Contains("Osteology")||group.Contains("Angiology")||group.Contains("Neurology")||group.Contains("Myology")||group.Contains("Radiology")||group.Contains("Misc. Drawings")||group.Contains("Clinical Testing"))
  {
      @*   do nothing  *@
  }
        else
        {
  <span class="skyblue-links">
  <a class="article-title" href="@Url.RouteUrl("ArticlePost", new { SeName = item.SeName })">@T("FoxNetSoft.Plugin.Misc.PageTitle.NextRead")</a>
  </span>
        }


I will post the error on next reply because field is too small

Posted: 10 years ago

#223 Quote

steve@sitesee.net

Posted: 10 years ago

#223 Quote
The error:

Index and count must refer to a location within the string. Parameter name: count

System.ArgumentOutOfRangeException: Index and count must refer to a location within the string. Parameter name: count at System.String.RemoveInternal(Int32 startIndex, Int32 count) at ASP._Page_Plugins_FoxNetSoft_Articles_Views_ArticleRead_List_cshtml.Execute() in c:\inetpub\wwwroot\MFS_DEV_3point4\Plugins\FoxNetSoft.Articles\Views\ArticleRead\List.cshtml:line 99 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

It is referring to this line:
string sLess = s.Remove(0, 12);

The only groups that do not have at least 12 characters are defined in my if/else condition, so I cannot understand why it encounters any situation in which the cou

Posted: 10 years ago

#224 Quote

steve@sitesee.net

Posted: 10 years ago

#224 Quote
The only groups that do not have at least 12 characters are defined in my if/else condition, so I cannot understand why it encounters any situation in which the count parameter is seen as zero or null.

Any ideas why it fails now?

Thanks,
Steve

Posted: 10 years ago

#226 Quote

Support

Posted: 10 years ago

#226 Quote
Can you rewrite difficult condition?
 if (group.Contains("Spacial Orientation")||group.Contains("Topography")||group.Contains("Osteology")||group.Contains("Angiology")||group.Contains("Neurology")||group.Contains("Myology")||group.Contains("Radiology")||group.Contains("Misc. Drawings")||group.Contains("Clinical Testing"))


make new List

Posted: 10 years ago

#227 Quote
I would like to simply the conditional clause, but I could not find an easier way because the model does not include the article's parent group name. If it did, I could easily change my condition to this:
    
    string group = Model.ArticleParentGroupName;

    

    if (group.Contains("Anatomy"))
The problem is this:
All of our articles which are in the Anatomy parent group have no text in the article description field..only an image reference, so I need for my string manipulation code to be "skipped" for all articles in that parent group because the string.Remove method will have exception if there is no text to manipulate.
I can't understand what is different about 3.4 that makes my working code now fail.

I am open to any suggestions...

Posted: 10 years ago

#228 Quote
Then FOXNETSOFT said:

1. ShortBody  has html decoded text. ex.
Body
<p><img src="/Content/Images/uploaded/Anatomy/Spacial_Orientation/dp_foot_mod_labeled.jpg" width="419" height="424" /></p>

ShortBody will be empty.

2. You wrote bad code. Please change it. from
if (s.Length>13) to if (s.Length<12)

  if (s.Length<12)
      {
    thestrbody = strbody;
            }
      else
      {
           string sLess = s.Remove(0, 12);
           int index = sLess.IndexOf("Summary");
           if (index!=-1)
    {        
      thestrbody = (sLess.Substring(index + 8));
          }
  }

second block, you should think about condition

   @thestrbody

       @if (s.Length<12) ???????????
  {

read this link about your error
http://www.codeproject.com/Questions/163948/Index-and-count-must-refer-to-a-location-within-th


3. About List
ex.
List<string> groups=new List<string>();
groups.Add("test1");
groups.Add("test2");
groups.Add("test3");
...
groups.Add("test100");
//or List<string> groups=new List<string>("test1", "test2",..., "test100");

string groupname="test1";
if (groups.Any(x=>string.Compare(x,groupname,StringComparison.OrdinalIgnoreCase)==0))

http://stackoverflow.com/questions/19676557/checking-if-string-exists-in-list-c-sharp

I wrote the code in notepad (please verify in Visual Studio)

Posted: 10 years ago

#229 Quote
Thank you again!
I feel stupid for not noticing that...I made the correction, and now it is working perfectly!
Thank you for the information and link about how to check if a string exists in a list. A very useful tool.

Powered by nopCommerce

Copyright © 2023 FoxNetSoft. All rights reserved