Migration Telerik ASP.NET MVC from 2016.3.1028.545 to 2022.1.119.545

2 Answers 47 Views
General Discussions
Mariano
Top achievements
Rank 1
Iron
Mariano asked on 15 Feb 2022, 10:24 AM

Hi,

in our company we are testing migration Migration Telerik ASP.NET MVC from 2016.3.1028.545 to 2022.1.119.545.

Our app now is working with .NET 4.8.

We have upgrade all microsoft asp.net mvc references to make compatibles with new teleric dll.

We have migrated dll through upgrade wizard (Api Analyzer didnt work, when we have select all selection it began to run and swicht off)

We have changed all scripts, styles manually.

We have changed file kendo-ui.d.ts for kendo.all.d.ts manually

then when we have compiled app we get an error :

Error	TS2339	(TS) Property '_decorateMessageContainer' does not exist on type 'Validator'.	

It seems that in kendo.all.d.ts , in Validator doesnt exists property '_decorateMessageContainer' anymore, so our function doesn't work:


function addValidationEvent() {
    var oDecorateMessageContainer = kendo.ui.Validator.fn._decorateMessageContainer;
    kendo.ui.Validator.fn._decorateMessageContainer = function () {
        $('[name="' + arguments[1] + '"]').trigger("validation-error");
        return oDecorateMessageContainer.apply(this, arguments);
    };

    var oValidateInput = kendo.ui.Validator.fn.validateInput;
    kendo.ui.Validator.fn.validateInput = function () {
        arguments[0].trigger("validation-check");

        return oValidateInput.apply(this, arguments);
    };
}

Id like to know :

1º) Can we upgrade directly from 2016 Telerik version to 2022 or we have to upgrade first to another version.

2º) Is version 2022 the better version for our app or is better another earlier one ?

3º) How can i fix the error explained below?

 

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Yanislav
Telerik team
answered on 18 Feb 2022, 08:54 AM

Hello Mariano,

Let me address your questions below :

1. Yes, you can upgrade directly, but since the version is quite outdated, it is actually expected some problems to appear.

2. Subsequent releases contain fixes and improvements, so yes, I recommend you to use the latest version. We are doing our best to avoid introducing breaking changes. In rare cases, when such changes are needed, we document them. You can find the MVC Breaking Changes documentation section here:

https://docs.telerik.com/aspnet-mvc/backwards-compatibility/2021-backwards-compatibility
and the Kendo UI one here:

https://docs.telerik.com/kendo-ui/backwards-compatibility/2021-backward-compatibility
The MVC components are wrappers of the Kendo UI for jQuery widgets, so almost all the changes to the widgets affect the MVC helpers as well.

3. About the issue, it is unusual to receive a TS exception since, as I see, you are trying to override a JS functionality of the Validator. I've checked the source and it seems like the private function _decorateMessageContainer still exists in the kendo.validator.js file. However, since it's not recommended for the private methods to be overridden, may I ask you what is your aim as a final result of this modification, so I can try to come up with a possible workaround that does not require modifications to the source code.

Regards,
Yanislav
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Mariano
Top achievements
Rank 1
Iron
answered on 22 Feb 2022, 09:59 AM

Hello,

thanks for your answer.

1) Thanks, it's good to know we can do it

2) Thanks for the links

3) We are doing improvements to app, but we didnt create it and we dont have any doc about pourpouse about overriding functions.

As i told you in first message problem comes since we have updated file kendo-ui.d.ts with kendo.all.d.ts 

In Kendo-ui.d.ts there was this code: (// Type definitions for Kendo UI Professional v2015.3.1111)

class Validator extends kendo.ui.Widget {

        static fn: Validator;

        options: ValidatorOptions;


        element: JQuery;
        wrapper: JQuery;

        static extend(proto: Object): Validator;

        constructor(element: Element, options?: ValidatorOptions);


        errors(): any;
        hideMessages(): void;
        validate(): boolean;
        validateInput(input: Element): boolean;
        validateInput(input: JQuery): boolean;
        _decorateMessageContainer(input: Element): boolean;
        _decorateMessageContainer(input: JQuery): boolean;

    }


In kendo.all.d.ts: (// Type definitions for Kendo UI Professional v2022.1.119)

class Validator extends kendo.ui.Widget {

        static fn: Validator;

        options: ValidatorOptions;


        element: JQuery;
        wrapper: JQuery;

        static extend(proto: Object): Validator;

        constructor(element: Element, options?: ValidatorOptions);


        errors(): any;
        hideMessages(): void;
        hideValidationSummary(): void;
        reset(): void;
        showValidationSummary(): void;
        validate(): boolean;
        validateInput(input: Element): boolean;
        validateInput(input: JQuery): boolean;
    }

As you can see in new version it doesnt exitst:

 _decorateMessageContainer(input: Element): boolean;
 _decorateMessageContainer(input: JQuery): boolean;

 

Yanislav
Telerik team
commented on 25 Feb 2022, 09:24 AM

Hello Mariano,

Thank you for sharing your findings. However, I'm afraid that the inheriting/overriding of Kendo classes and controls is not supported, even if the new class/control is inherited directly from the Kendo component. 
https://docs.telerik.com/kendo-ui/intro/widget-basics/create-custom-kendo-widget#note-on-technical-support

With that said, my recommendation is to clarify what's the desired final result, so we could try to find a workaround that does not require the overriding of private methods. Alternatively, if specific functionality is required and you think it could improve the Telerik Validator, I suggest logging a feature request in our Feedback Portal. If you decide to log it, please elaborate more on how you envision this functionality to work. Alternatively, we can log it on your behalf.

Mariano
Top achievements
Rank 1
Iron
commented on 28 Feb 2022, 08:58 AM

Hi,

thanks for your answer.

All code i've posted comes from files from your side: files kendo.all.d.ts and kendo.ui.d.ts

I dont know if it's possible or not to override/inherite Kendo classes 'cause it's my firts time with kendo. But code i've posted comes from files that they are in your packet.

Thanks in advance.

Yanislav
Telerik team
commented on 02 Mar 2022, 04:57 PM

Hello Mariano, 

Yes, I am afraid this is a breaking change.

Overriding or using private methods is actually not recommended since it may lead to unexpected behavior and the might change with versions. The functions declared with  '_' in front of the name are used for internal logic only. These are not supposed to be used by external script.

I've checked the source, and it seems like the private function _decorateMessageContainer still exists in the kendo.validator.js file, so it still exists but not in the TS files. The TypeScript files were designed to hold only Public methods. So there are 2 possibilities:

1. The Dev who build up the project several years ago has manually added this method which doesn't exist in the new 2022 TS file.

2. We included it by mistake in version 2015 but removed it in 2022.

In both cases, you can fix the error by removing (or altering) this part of the script:

    var oDecorateMessageContainer = kendo.ui.Validator.fn._decorateMessageContainer;
    kendo.ui.Validator.fn._decorateMessageContainer = function () {
        $('[name="' + arguments[1] + '"]').trigger("validation-error");
        return oDecorateMessageContainer.apply(this, arguments);
    };
Excuse us for any inconvenience this might have caused you. I've upgraded your Telerik Points for this hurdle.

Tags
General Discussions
Asked by
Mariano
Top achievements
Rank 1
Iron
Answers by
Yanislav
Telerik team
Mariano
Top achievements
Rank 1
Iron
Share this question
or