[Bug]: Dnn 10.2.1 breaks 2sxc because of changes in DnnJsInclude
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with DNN Platform/DotNetNuke.Web.Client/Controls/DnnJsInclude.cs, especially the constructors and the clientResourceController property cited in the issue. Reproduce the crash using the listed steps with DNN 10.2.0/10.2.1 and a 2sxc version up to 21.00.01, then trace how the controller is obtained. Done means registering JS dependencies no longer crashes IIS for those versions.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
Basically if 2sxc uses ClientDependency it crashes.
This started in 10.2.0 and got a fix in 10.2.1 but it not working properly.
The result is a full blown IIS crash, unhandled win32 exception
Reason is that 2sxc creates a DnnJsInclude and adds it to the page. We will change our code to work around the problem, but anybody upgrading DNN with a current or older 2sxc will crash the entire IIS process - see https://github.com/2sic/2sxc/issues/3717.
Here's how our code works:
var include = new DnnJsInclude
{
ForceProvider = DnnProviderName(clientAsset.PosInPage),
Priority = clientAsset.Priority,
FilePath = clientAsset.Url,
AddTag = false
};
// direct dependency on ClientDependency.Core.dll (included in default DNN installation)
if (clientAsset.HtmlAttributes?.Count > 0)
{
// not important for this issue
}
// THIS IS WHERE IT BLOWS
page.FindControl("ClientResourceIncludes")?.Controls.Add(include);
The problem is probably here:
Basically an empty constructor was "added back" - which I guess was a great idea, but later on it expects a service which doesn't exist in the empty constructor scenario. My guess is that in certain cases, the empty constructor doesn't properly run this:
I guess the problem is that this property
My guess is as follows
- I think that the compiler adds another empty constructor (just a guess) to web controls
- ...and that we're probably calling that, instead of the new one but I'm just guessing. If my guess is correct, the
this(null)would not be called. Or there is a problem that the built-in webcontrol base constructor is not called. again, just guessing.
So again: we'll create a 2sxc 21.0x soon to work around this, as we were only using this API to work around something, which was later added to DNN. But anybody upgrading DNN without previously upgrading 2sxc will run into problems.
My guess for a fix would be something like:
private IClientResourceController clientResourceController => field ??= DependencyInjection.GetCurrentServiceProvider().GetRequiredService<IClientResourceController>();
...might fix the problem - @donker
Steps to reproduce?
- install any 2sxc up to v21.00.01 on the latest DNN.
- Add a normal app or content-module, which wants to register JS dependencies.
- See IIS crash.
Current Behavior
see above
Expected Behavior
No response
Relevant log output
Anything else?
No response
Affected Versions
10.2.0 (latest v10 release)
What browsers are you seeing the problem on?
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- C#
- Stars
- 1.1k
- Forks
- 791
- Avg merge
- 2d 49m
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dnnsoftware/Dnn.Platform
-
Status: New
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
dnnsoftware/Dnn.Platform#7571 ·
Maintainers usually reply within 2 days
-
[Bug]: Edit Bar buttons are not localizedPossibly taken @idumlupinar claimed this 3 days ago. OpenStatus: New
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dnnsoftware/Dnn.Platform#7565 ·
Maintainers usually reply within 2 days
-
[Bug]: DNN 10.4.0 assembly registration fails for a two-component file version (Owin.dll)Possibly taken @cdg191 claimed this 2 days ago. OpenStatus: New
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dnnsoftware/Dnn.Platform#7543 · 5 comments ·
Maintainers usually reply within 2 days
-
Status: New
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
dnnsoftware/Dnn.Platform#6681 ·
Maintainers usually reply within 2 days
-
Status: New
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dnnsoftware/Dnn.Platform#6051 · 4 comments ·
Maintainers usually reply within 2 days
All issues in dnnsoftware/Dnn.Platform
Similar issues
-
Backend enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
dimitar-radenkov/Pointframe#271 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
qew21/Genshin-Subtitles#45 ·
-
bug priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
space-wizards/RobustToolbox#7158 ·
Maintainers usually reply within 1 day