No Parameterless Constructor Defined for this Object on InitApplication()

kentico guy asked on December 12, 2019 22:16

I recently upgraded an instance of Kentico from 8.2 up to 12, one step at a time, compiling each along the way. The app is now on version 12.0.15 and it would run fine until I added back in some custom code. The app compiles fine and runs for a little bit but I'm getting "No parameterless constructor defined for this object" on the line InitApplication(Assembly.GetExecutingAssembly()); in Global.ascx.cs.

I have done this upgrade before without issues so it must be something to do with the custom code. There is too much code to post, but I'm wondering if anyone has ever seen something like this before? Even just giving me some ideas for things to check would help. The exception itself does not give any details on what object lacks the parameterless constructor. I don't know what I can do about adding parameterless constructor since this is a default CMS method InitApplication(Assembly). The Assembly.GetExecutingAssembly() is returning fine, so it must be InitApplication that is missing a parameterless constructor.

Please help with recommendations; I've been stuck on this for over a week.

Recent Answers

Trevor Fayas answered on December 13, 2019 04:01

If I were to take a guess, maybe a custom initialization module is miss defined, it probably changed from 8.2, look for anything attaching events (search ".Before +=" or ".After +=" in your code). Look at how they are done now (search documentation for global events)

Sorry for no links, from mobile

0 votesVote for this answer Mark as a Correct answer

kentico guy answered on December 13, 2019 22:26

thanks for your response. I've checked those overrides and it looks like the .Before += and .After += are implemented correctly. I cannot see any change of syntax that would cause issues. We are also overriding OnInit(), which appears to be the correct implementation. Is there anything else recommended to check?

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on December 16, 2019 21:46

I have had a similar error before using MVC. I use resharper and when I would have it create methods for me it would create them as protected instead of public, not sure if that helps.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.