Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

News App v4.1.1 Breaks after upgrade to 2sxc v16.07.00 #28

Closed
jeremy-farrance opened this issue Dec 16, 2023 · 4 comments
Closed

News App v4.1.1 Breaks after upgrade to 2sxc v16.07.00 #28

jeremy-farrance opened this issue Dec 16, 2023 · 4 comments

Comments

@jeremy-farrance
Copy link

jeremy-farrance commented Dec 16, 2023

I have an older project from 2020. After upgrading to DNN v9.13.01 (from 9.09.01) and to 2sxc v16.07.00 (from 13.12.1 and before that from 11.22.0), the unmodified News App v4.1.1 throws the following error.

Error: System.ArgumentException: Only '.cs' file paths can start with a slash at 
ToSic.Sxc.Dnn.RazorCodeManager.get_CodeOrException() in 
C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\RazorCodeManager.cs:line 41 at 
ASP._Page_Portals_0_2sxc_News4_shared__List_Paging_cshtml.Execute() in 
C:\HostingSpaces\ ... \www\Portals\0\2sxc\News4\shared\_List Paging.cshtml🎯:line 7 at 
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at 
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, 
WebPageRenderingBase startPage) at System.Web.WebPages.WebPageBase.<>c__DisplayClass40_0.
<RenderPageCore>b__0(TextWriter writer) at System.Web.WebPages.WebPageBase.Write(HelperResult result) at 
ASP._Page_Portals_0_2sxc_News4__List_cshtml.Execute() in 
C:\HostingSpaces\ ... \www\Portals\0\2sxc\News4\_List.cshtml🎯:line 50 at 
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at 
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, 
WebPageRenderingBase startPage) at ToSic.Sxc.Engines.DnnRazorEngine.Render(TextWriter writer, Object data) in 
C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Engines\Razor\DnnRazorEngine.cs:line 109 --- End of stack trace 
from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at ToSic.Sxc.Engines.DnnRazorEngine.Render(TextWriter writer, Object data) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Engines\Razor\DnnRazorEngine.cs:line 116 at ToSic.Sxc.Engines.DnnRazorEngine.RenderTemplate(Object data) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Engines\Razor\DnnRazorEngine.cs:line 124 at ToSic.Sxc.Engines.EngineBase.Render(Object data) in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Engines\EngineBase.cs:line 178 at ToSic.Sxc.Blocks.BlockBuilder.RenderInternal(Object data) in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Blocks\BlockBuilder_Render.cs:line 134

Here is the app version
https://github.com/2sic/app-news/tree/v04.01.01

Line 50 here
https://github.com/2sic/app-news/blob/v04.01.01/_List.cshtml

And it claims Line 7 here (which doesn't make sense?)
https://github.com/2sic/app-news/blob/v04.01.01/shared/_List%20Paging.cshtml

I tried moving the shared files from the subfolder up to the app root (2sxc/News4) and also renamed them with and without the underscore and space. Same error each time.

I have not been able to come up with a fix. Any suggestions or ideas?

@jeremy-farrance
Copy link
Author

Further problems. So since the error was on Paging, I went in to the ViewConfiguration and turned off the paging and set ItemsInPage to 999. This fixed it, now I have many dozens of news items on the page with page - much better, however, when you click on the article to go to News4/_Details.cshtml, you get the same error again and this time its the same on Line 23:

Error: System.ArgumentException: Only '.cs' file paths can start with a slash at ToSic.Sxc.Dnn.RazorCodeManager.get_CodeOrException() in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\RazorCodeManager.cs:line 41 at ASP._Page_Portals_0_2sxc_News4__Details_cshtml.Execute() in C:\HostingSpaces\CUA\cuaerospace.com\www\Portals\0\2sxc\News4\_Details.cshtml🎯:line 23 at...

So to fix that I move the @ helpers and functions from the .code.cshtml up to the _Details.csthml and update the code. This works, but now the Inner Html blows this error:

Error: System.NullReferenceException: Object reference not set to an instance of an object. at 
ToSic.Sxc.Edit.EditService.EditService.ConnectToRoot(IDynamicCodeRoot codeRoot) in 
C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Edit\EditService\EditService.cs:line 26 at 
ToSic.Sxc.Blocks.RenderService.GetEditService(IBlock blockOrNull) in 
C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Blocks\Renderers\RenderService.cs:line 174 at 
ToSic.Sxc.Blocks.RenderService.All(ICanBeItem parent, String noParamOrder, String field, String apps, Int32 max, 
String merge) in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Blocks\Renderers\RenderService.cs:line 143 at 
ToSic.Sxc.Blocks.Render.All(DynamicEntity parent, String noParamOrder, String field, String apps, Int32 max, String 
merge) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Core\Compatibility\Sxc\ToSic.Sxc.Blocks.Render.cs:line 65 at 
System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 
arg3) at ASP._Page_Portals_0_2sxc_News4_CUA__News__Details_cshtml.Execute() in 
C:\HostingSpaces\CUA\cuaerospace.com\www\Portals\0\2sxc\News4\CUA\_Details.cshtml🎯:line 68 at ...

and lines 67-69 are this, which I have no idea how to fix:

    <div class="app-news-detail-body">
      @ToSic.Sxc.Blocks.Render.All(article, field: "InnerContent", merge: article.Content)
    </div>

@iJungleboy
Copy link
Contributor

Sorry didn't see this sooner.
I believe somewhere the old feature Code-Behind broke, and we didn't notice it for a long time as all our apps are now Hybrid, which can't use the Code-Behind.

We discovered and fixed it in v16.09 but didn't release it as LTS since we didn't run it through all the extensive manual tests.

@jeremy-farrance
Copy link
Author

Please re-open. Though you are correct that 16.09 fixed problem 1 above (.code.cs partials), the second problem still (inner content error) exists. Details above have not changed. I would probably not be willing to try v17 on this site yet. So hopefully there is a possible fix for 16.09.01? Or maybe there is a way to write the code differently? Again, this is unmodified News 4.1.1, _Details.cshtml line 68.

@iJungleboy
Copy link
Contributor

I'm confused as to what works and what not - and I would not be able to forward this issue to anybody in this state.

Could you open another issue with the remaining problem? many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants