Troubleshooting Custom Controls
Learn about issues you could experience when working with coded custom controls.
Issue: An exception is thrown that says an extender control is not a registered extender control. This happens when you try run a view with a coded custom control on it. The error text is similar to the following:
Exception of type 'System.Web.HttpUnhandledException' was thrown.
Extender control '051e8d1f-a507-1458-1c00-24c48dc98582_6c86b645-1aeb-4ae9-bbba-f3b912f57515' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors().
Parameter name: extenderControl
This is a generic error that can have many causes. To find the underlying cause, enable logging by creating a C:\Debug folder and assign full rights to the app service account (this path can be changed in the web.config).
-- <add key="Forms.Global.ErrorLogging.FilePath" value="C:\Debug\SourceCode.Forms.Web.error" />
The exception is thrown when you run the view and happens when you change the property in the control to a type that is different from the original type. For example:
- You create the custom control with a string property in C# code.
- You create a view, add the control, and set the property to a non-numeric text.
- Then you change the property in the control’s C# code to an integer.
- When you run the view the exception occurs.
Resolution: Make sure the data type in the control is not changed. Also note that the GUID shown in the error is the table where the problem is.
Typically, when you see a form that is not rendering correctly, for example the styling is wrong, you most likely have a cache issue.
The sections below describe clearing the SmartForms cache. These are listed from lowest to highest impact.
- This can happen when you execute a SmartObject in the control and the data from the SmartObject is not current. Use a browser hard-refresh (Ctrl + F5) to clear the cache and reload the page from the server.
- Sometimes you need to clear the cache using a different method. K2 has a built-in method of clearing the cache.Add the following query parameter to your URL: cachecontrol.ashx?m=clear.
For example:
https://k2.denallix.com/Designer/cachecontrol.ashx?m=clear
This will return the result completed if successful. - If you've tried these two methods listed above and you're still experiencing issues, force the combined resource URLs to be rebuilt:
- Open the relevant sites web.config file in a text editor and find the Post Render Combining settings section.
- Set the value of the Enabled property to "false" as shown here:
<!-- Post render combining settings -->
<addkey="Forms.PostRenderCombining.Enabled"value="false"/> - Restart the K2 Service and do a browser hard-refresh with Ctrl+F5.
- Change the Enabled property back to "true"; this is important for performance reasons.
- Restart the K2 Service and do a browser hard-refresh with Ctrl+F5.
- K2 also implementers IIS Output Caching which can be cleared by running the IISRESET command.
Issue: You get an error that strict MIME type checking is enabled. The error text shows a mismatch of the content type expected.
Refused to execute script from 'https://k2.denallix.com/Designer/Utilities/AJAXCall.ashx?method=getthemes' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
Resolution: To fix the error, you must correctly set the content type in your control's response from the server. In this example, you must change the type application/json to application/javascript.
Internet Explorer does not show an image if the extension of the image is not the same as the actual content of the image. For example, if the image is a JPEG/JPG but the file extension is set to PNG, the image is blocked.