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

DNN 9.7.0-RC2 Upgrade Causes 2sxc Streams to Fail #4003

Closed
1 of 2 tasks
SkyeHoefling opened this issue Aug 21, 2020 · 22 comments
Closed
1 of 2 tasks

DNN 9.7.0-RC2 Upgrade Causes 2sxc Streams to Fail #4003

SkyeHoefling opened this issue Aug 21, 2020 · 22 comments
Milestone

Comments

@SkyeHoefling
Copy link
Contributor

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

@bdukes
Copy link
Contributor

bdukes commented Aug 21, 2020

@iJungleboy have y'all done any 9.7.0 testing yet? Any thoughts on what could cause an error like this?

@bdukes
Copy link
Contributor

bdukes commented Aug 21, 2020

@ahoefling can you do a repair install of 2sxc and see if you still get the error?

@SkyeHoefling
Copy link
Contributor Author

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

@iJungleboy
Copy link
Contributor

@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.

@bdukes
Copy link
Contributor

bdukes commented Aug 21, 2020

There are a couple of small DI changes, but nothing that I would expect to disrupt your setup.

@SkyeHoefling
Copy link
Contributor Author

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?

@bdukes
Copy link
Contributor

bdukes commented Aug 21, 2020

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:
Folder diff part 1
Folder diff part 2
Folder diff part 3

web.config differences:
web.config diff part 1
web.config diff part 2
web.config diff part 3
web.config diff part 4
web.config diff part 5

@iJungleboy
Copy link
Contributor

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.

My guess

  1. my understanding is that it can't get the ModuleId. There is some code which asks for the current module (Similar to PortalSettings.Current) and this doesn't seem to get anything
  2. Note also that the error log which @ahoefling gave right at the beginning said Portal = -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.

@iJungleboy
Copy link
Contributor

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

https://github.com/2sic/2sxc/blob/fb8a783ca050777f78f0d63c8b304f5f3dcde740/ToSIC_SexyContent/2sxc%20Dnn/Dnn/LookUp/TokenReplaceDnn.cs

It seems that now in 9.7 RC2 the Module is now an EmptyPropertyAccess - see this screenshot

image

Any ideas?

@bdukes
Copy link
Contributor

bdukes commented Aug 24, 2020

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

@skarpik
Copy link

skarpik commented Aug 27, 2020

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.

@valadas
Copy link
Contributor

valadas commented Aug 27, 2020

@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.

@iJungleboy
Copy link
Contributor

@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.

@iJungleboy
Copy link
Contributor

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.

@mitchelsellers
Copy link
Contributor

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.

@WillStrohl
Copy link
Contributor

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. :(

@valadas
Copy link
Contributor

valadas commented Aug 28, 2020

@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.

@iJungleboy
Copy link
Contributor

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

@iJungleboy
Copy link
Contributor

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);

@david-poindexter
Copy link
Contributor

Closing per #4018 - thanks again @iJungleboy for the fix and to @ahoefling for reporting - all around great teamwork!

@david-poindexter david-poindexter added this to the 9.7.1 milestone Aug 28, 2020
@skarpik
Copy link

skarpik commented Aug 29, 2020

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.

@david-poindexter
Copy link
Contributor

That is great news @skarpik - thanks for testing and reporting back your findings!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants