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.
The module crashes and fails to load.
The module should run as expected when it was using DNN 9.6.2
N/A
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
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
N/A
@iJungleboy have y'all done any 9.7.0 testing yet? Any thoughts on what could cause an error like this?
@ahoefling can you do a repair install of 2sxc and see if you still get the error?
I just ran a repair and it did not fix the problem
@bdukes nope, haven't done any testing yet.
My guess is something with dependency injection. Did you change anything there? or modify web.config DLL pointers? because 2sxc still uses the old 1.1 DI of .net core, which is placed in a subfolder of .bin.
There are a couple of small DI changes, but nothing that I would expect to disrupt your setup.
The 2 DI engines are isolated from each other, the changes in DI for DNN shouldn't cause problems in 2sxc. I agree with @iJungleboy that the web.config would be the first place to look.
@bdukes you mentioned you did a file compare on the web.config and didn't notice anything on 3rd party libs. Did we update any binding redirects for microsoft dlls?
I've installed 9.6.2 and 9.7.0-RC2 with 2Sxc 10.25.2. The blog app was broken on both of them, but the news app was only broken on 9.7.0. Comparing the two sites, I find no important differences in DLLs or web.config.
Folder/file differences:



web.config differences:





I just ran a quick test with the same using 2sxc 11.4 - same problem.
My message says this BTW:
System.Exception: Looking up BlockConfiguration failed because ModuleId is null. at ToSic.Sxc.DataSources.CmsBlock.get_BlockConfiguration() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\DataSources\CmsBlock.cs:line 100 at ToSic.Sxc.DataSources.CmsBlock.GetContent() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\DataSources\CmsBlock.cs:line 125 at ToSic.Eav.DataSources.DataStream.ReadUnderlyingList() in C:\Projects\eav-server\ToSic.Eav.DataSources\Streams\DataStream.cs:line 118 --- End of inner exception stack trace --- at ToSic.Eav.DataSources.DataStream.ReadUnderlyingList() in C:\Projects\eav-server\ToSic.Eav.DataSources\Streams\DataStream.cs:line 138 at ToSic.Eav.DataSources.DataStream.get_List() in C:\Projects\eav-server\ToSic.Eav.DataSources\Streams\DataStream.cs:line 103 at ToSic.Eav.LookUp.LookUpInDataTarget.Get(String key, String format, Boolean& notFound) in C:\Projects\eav-server\ToSic.Eav.DataSources\LookUp\LookUpInDataTarget.cs:line 59 at ToSic.Eav.LookUp.TokenReplace.RetrieveTokenValue(String sourceName, String key, String format) in C:\Projects\eav-server\ToSic.Eav.Core\LookUp\TokenReplace.cs:line 157 at ToSic.Eav.LookUp.TokenReplace.ReplaceTokens(String sourceText, Int32 repeat) in C:\Projects\eav-server\ToSic.Eav.Core\LookUp\TokenReplace.cs:line 120 at ToSic.Eav.LookUp.TokenReplace.ReplaceTokens(String sourceText, Int32 repeat) in C:\Projects\eav-server\ToSic.Eav.Core\LookUp\TokenReplace.cs:line 128 at
Now the lines of the latest code won't match these numbers as I've been working on these files.
PortalSettings.Current) and this doesn't seem to get anythingPortal = -1 etc. I think there is something wrong with the global objects like PortalSettings.Current etc. which don't seem to provide the correct stuff any more. Could it be that this changed? It would be a likely thing to get reworked as DI matures.
Update: 2sxc leverages the DNN token replace to inject various parameters incl. ModuleId into deeper layers.
For that it creates a TokenReplace object, gives it the ModuleId and PortalSettings and after a replace-run, uses the PropertySource to pass on all PropertySources for further use
It seems that now in 9.7 RC2 the Module is now an EmptyPropertyAccess - see this screenshot

Any ideas?
This token provider change is probably at least near where your issue is coming from: https://github.com/dnnsoftware/Dnn.Platform/pull/3820/files#diff-abf4e4ef8e94a1825c5e0e1050a83f51R132-R150
I can verify that this error is also present for fresh DNN 9.7.0 installs not just for installs that were upgraded from earlier versions of DNN and it is present in the final release of v9.7.0 not just in RC2. I encountered the error with the 2SXC Events and Courses module.
@iJungleboy So far Token replace has been working fine with Form&List, Newsletter, Html Module, etc. We did run testing on this and so far 2sxc is the only report we had about this problem. 2sxc being so popular it would be nice to have more eyes from you guys in our RCs testing and maybe get involved in figuring out the issue and submitting a PR ? Since we could not reproduce the issue with any other module, we thought this might be an isolated case and did not hold on 9.7.0 for this.
That being said we are now setup for very quick releases and if a solution comes quick we are ready to fire up a 9.7.1 very quickly.
@valadas I simply don't even know how to get a basic DNN 9.x Dev up and running on my system to do a deeper debugging :(. I'm afraid that will take hours - or is there a quick setup or container or VM or something which is just for kicking it off?
That said, all we're doing is initializing a TokenReplace object using : base(Scope.DefaultSettings, "", ps, userInfo, moduleId) so this should be easy to reproduce. After this, the sources inside it show a EmptyPropertyAccess on the ModuleService. I believe this should be really easy to reproduce (if you have a running DNN dev environment.
I would like to ask that this is solved before we release - I expect that 2sxc and DNN would get over 300+ requests of early adopters running into the same bug, which always is very bad for trust in the platform. So if you can fix it awesome, if you can guide me to a very fast setup-dnn-as-dev that's ok too.
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.
Also, if anyone has a publicly available extension, it's up to each individual vendor to test their respective extensions when RC's are out. I admit that I didn't do much testing for Hotcakes for the last two releases myself. :(
@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.
@valadas I'll give it a try, thx.
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);
Closing per #4018 - thanks again @iJungleboy for the fix and to @ahoefling for reporting - all around great teamwork!
I can verify that this error is also present for fresh DNN 9.7.0 installs not just for installs that were upgraded from earlier versions of DNN and it is present in the final release of v9.7.0 not just in RC2. I encountered the error with the 2SXC Events and Courses module.
Tested DNN 9.7.1 RC1 with 2SXC Events and Courses. Appears that the problem is fixed.
That is great news @skarpik - thanks for testing and reporting back your findings!