Dnn.Platform: DNN 9.7.0-RC2 Upgrade Causes 2sxc Streams to Fail

Description of bug

I was testing 9.7.0-RC2 on one of my sites that uses 2sxc Streams in one of it’s templates. This was working without issue in 9.6.2 and when I upgraded to 9.7.0-RC2 any 2sxc app that uses Streams are failing to load.

Steps to reproduce

  1. Install DNN 9.6.2
  2. Install 2sxc 10.25.2
  3. Add a 2sxc app to the page that uses Streams such as the Blog App
  4. Certify it is working correctly
  5. Upgrade DNN to 9.7.0-RC2
  6. Navigate to the page with the 2sxc Blog App

Current behavior

The module crashes and fails to load.

Expected behavior

The module should run as expected when it was using DNN 9.6.2

Screenshots

N/A

Error information

DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke

ExceptionGUID:2c8bc683-1f97-4cd9-ad9d-bd8634810b2a

AssemblyVersion:

PortalId:-1

UserId:-1

TabId:-1

RawUrl:

Referrer:

UserAgent:

ExceptionHash:b7FgndJm0/HMtnIzVIsI6xiKLdo=

Message:Error getting List of Stream. Stream Name: Default DataSource Name: CacheAllStreams

StackTrace:

   at ToSic.Eav.DataSources.DataStream.<get_List>g__EntityListDelegate|20_0() in C:\Projects\eav-server\ToSic.Eav.DataSources\Streams\DataStream.cs:line 100
   at ToSic.Eav.DataSources.Caching.ListCache.GetOrBuild(IDataStream stream, Func`1 builderFunc, Int32 durationInSeconds) in C:\Projects\eav-server\ToSic.Eav.DataSources\Caching\ListCache.cs:line 94
   at ToSic.Eav.DataSources.DataStream.get_List() in C:\Projects\eav-server\ToSic.Eav.DataSources\Streams\DataStream.cs:line 110
   at ToSic.SexyContent.Razor.SexyContentWebPage.AsDynamic(IDataStream stream) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\SexyContentWebPage.cs:line 94
   at ASP._Page_Portals_2_2sxc_Blog_App__FeaturedBlogs_cshtml.Execute() in e:\AndrewHoefling.dnn.dev\Website\Portals\2\2sxc\Blog App\_FeaturedBlogs.cshtml:line 2
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at ToSic.Sxc.Engines.RazorEngine.Render(TextWriter writer) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\Engines\Razor\RazorEngine.cs:line 82
   at ToSic.Sxc.Engines.RazorEngine.RenderTemplate() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\Engines\Razor\RazorEngine.cs:line 92
   at ToSic.Sxc.Engines.EngineBase.Render() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\Engines\EngineBase.cs:line 108
   at ToSic.Sxc.Blocks.CmsBlock.Render() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\Blocks\CmsBlock_Render.cs:line 54
InnerMessage:Error getting List of Stream. Stream Name: Default DataSource Name: Paging

InnerStackTrace:

   at ToSic.Eav.DataSources.DataStream.<get_List>g__EntityListDelegate|20_0() in C:\Projects\eav-server\ToSic.Eav.DataSources\Streams\DataStream.cs:line 100
   at ToSic.Eav.DataSources.DataStream.get_List() in C:\Projects\eav-server\ToSic.Eav.DataSources\Streams\DataStream.cs:line 115
   at ToSic.Eav.DataSources.DataStream.<get_List>g__EntityListDelegate|20_0() in C:\Projects\eav-server\ToSic.Eav.DataSources\Streams\DataStream.cs:line 92
Source:ToSic.Eav.DataSources

FileName:

FileLineNumber:0

FileColumnNumber:0

Method:

Server Name: DESKTOP-8L05G7S

Additional context

The stacktrace doesn’t display any DNN specific code, but this exact same module and app were working fine on DNN 9.6.2. After I performed the upgrade it failed to load correctly. I wonder if there is some ASP.NET setting that has changed between the 2 versions or if it corrupted the 2sxc install when copying assemblies.

This was identified during research from #3986

Affected version

  • 09.07.00 release candidate
  • 09.06.02 latest supported release

Affected browser

N/A

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (20 by maintainers)

Commits related to this issue

Most upvoted comments

I think I found it - there is a funny mechanism in the TokenReplace which caused wrong values to be used. The code starts like this:

        /// <summary>
        /// Gets or sets /sets the current ModuleID to be used for 'User:' token replacement.
        /// </summary>
        /// <value>ModuleID (Integer).</value>
        public int ModuleId {
            get => TokenContext.Module?.ModuleID ?? Null.NullInteger;
            set => TokenContext.Module = GetModule(value);
        }

Then in the GetModule this happens

        private ModuleInfo GetModule(int moduleId)
        {
            if (moduleId == TokenContext.Module?.ModuleID)
                return TokenContext.Module;

            if (moduleId <= 0)
                return null;

            var tab = TokenContext.Tab ?? PortalSettings?.ActiveTab;
            if (tab != null && tab.TabID > 0)
                return ModuleController.Instance.GetModule(ModuleId, tab.TabID, false);

            return ModuleController.Instance.GetModule(ModuleId, Null.NullInteger, true);
        }

The bug happens on these two lines because of the upper-case ModuleId instead of moduleId. This accidentally uses the not-yet-set module-id (as it’s still in progress of finding it) to find it. Lower-casing it fixes everything:

                return ModuleController.Instance.GetModule(ModuleId, tab.TabID, false);

            return ModuleController.Instance.GetModule(ModuleId, Null.NullInteger, true);

@valadas I’ll give it a try, thx.

@iJungleboy A lot of effort went in to improve the build process and make it easier than it was, we documented the process at https://github.com/dnnsoftware/Dnn.Platform/blob/develop/.github/BUILD.md for many popular use case scenarios. If you follow that process and hit an issue, then we need to improve docs or the build process. Please give it a try and ping me up if you encounter problems I will be glad to help on that. Once that works, it should be as simple as building in debug mode and putting a breakpoint to figure out what is happening.

As an open-source project, the maintainers of DNN Platform have done more than I feel we should be obligated to do so, by checking more than 10 different implementations/usage of TokenReplace within the platform itself and external modules.

We cannot hold a release for a single third-party vendor. This isn’t meant as any sort of disrespect to 2sxc, or any users of 2sxc, or any other vendor for that matter, but the platform maintainers can ONLY be responsible for the platform. We have verified the platform is performing.

Local development environment is well documented in the documentation of this repo. If there is something found that requires a change on DNN Platform we can roll a 9.7.1 RC quickly after a PR is received.

I just ran a repair and it did not fix the problem