Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Errors after upgrading from 3.2.2 to 4.2.0 (Read 115 times)
klaatutrout
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Oct 26th, 2021
Errors after upgrading from 3.2.2 to 4.2.0
Jan 3rd, 2025 at 4:23pm
Print Post  
After upgrading our project via NuGet, we're unable to load a diagram. Everything appears to work fine on the back end (e.g., no compilation errors), but when we load the diagram on the page, we get the following error on the client page and nothing appears as expected:

Code
Select All
OpenProcessDesigner?processId=11:1737  Uncaught TypeError: Cannot read properties of undefined (reading 'create') 



The code snippet in question is:

Code
Select All
var diagramView = MindFusion.Diagramming.DiagramView.create(document.getElementById('diagramView_11')); 



NOTE:  This is but a snippet of the JavaScript that's laid down as part of the following Razor:

Code
Select All
@Html.DiagramView(Model.CurrentContext.DiagramView, new { style = "width:100%; height:81.75vh;", id = "mindFusionDiagramDiv" }) 



"diagramView_11" is the name of the diagram that we provide, however, the above line doesn't exist in our code, leading me to believe this is generated within MindFusion functionality.

We also have follow-on errors in the web console, but they may be a result of the original error (e.g., the diagram never being created):

Code
Select All
Uncaught TypeError: Cannot read properties of undefined (reading 'find') 



And the line in question (again, in various places):

Code
Select All
diagram = MindFusion.Diagramming.DiagramView.find("diagramView_" + activeFlowId).diagram; 



I read through the API changes and found there were differences elsewhere, but nothing jumped out at me regarding the above. (I did change the lines from MindFusion.Diagramming.Diagram.find() to the above as indicated by the API update documentation but that didn't resolve anything.

Any ideas?

(Note: We didn't upgrade to 4.3 since we're not a .NET Core shop (yet) and want to be able to get any fixes for the .NET framework components as described in the update notes.)
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #1 - Jan 6th, 2025 at 7:29am
Print Post  
Hi,

The project could be loading diagramming.js from version 3, where DiagramView type isn't defined indeed. Try overwriting it with script from MvcDiagram distribution.

The nuget package itself should deploy a wwwroot/js/MindFusion.Diagramming.js file, but update might not be overwriting for some reason, or the project could be loading the script from a different location (ClientScriptLocation property). You should also be able to find the script in nuget package cache folder (packages\mindfusion.diagramming.mvc).

https://learn.microsoft.com/en-us/nuget/consume-packages/managing-the-global-pac...

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
klaatutrout
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Oct 26th, 2021
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #2 - Jan 6th, 2025 at 6:38pm
Print Post  
Thanks; that was indeed the case:  MindFusion.Diagramming.js was still referring to the old version.  Once I replaced it with the version that came with 4.2.2, I was able to get past that error.

However, now I'm hitting others -- most of which are functions that changed surrounding the Diagram class.  Is there a single location that maps the changes between versions?  (I see the changes in the online documentation, but it's not as straightforward as seeing "the logic surrounding classA.function X in 3.2.2 is now referred to via classB.function Y".)  So far I've stumbled through a few of them (e.g., Diagram.setZoomFactor --> DiagramView.zoomFactor), but others are a little less clear (such as diagram.setBounds).
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #3 - Jan 7th, 2025 at 8:10am
Print Post  
Hi,

Try following the "JavaScript API changes" under version 4 here:

https://www.mindfusion.eu/onlinehelp/mvcdiagram/CC_Version_History_14.htm

With new property syntax you set bounds like:

Code
Select All
diagram.bounds = new Rect(...); 



If you prefer the obj.setProp(value) function-call syntax, set this flag:

https://www.mindfusion.eu/onlinehelp/mvcdiagram/P_MindFusion_Diagramming_CompatC...

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
klaatutrout
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Oct 26th, 2021
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #4 - Jan 7th, 2025 at 8:50pm
Print Post  
Thanks for the reference; I saw this previously but was hoping there'd be something a little clearer.  I'll give this a deeper dive (but may not have to given you highlighting how to change the attributes to use the old style).

I do have one more question that I'm hoping you can assist me with.  Like my original issue, I'm now getting the following error:

Code
Select All
Uncaught TypeError: Cannot set properties of undefined (setting 'src') 



When I investigate the source code, it's again coming from what's being laid down by the original canvas via the following Razor:

Code
Select All
@Html.DiagramView(Model.CurrentContext.DiagramView, new { style = "width:100%; height:81.75vh;", id = "mindFusionDiagramDiv" }) 



I've attached the HTML generated by the above method.  When I click on the error in the browser developer tools, it takes me to the following line:

Code
Select All
diagramView.fromJson(diagramView.element.getAttribute('data-json')) 



  

diagramView_11.txt ( 99 KB | 10 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #5 - Jan 8th, 2025 at 7:27am
Print Post  
What's the call stack for that error (shown in browser debug console)? I can see src assignments in diagram's code that loads images, but can't imagine what could go wrong there. Maybe search for src assignments in your project, possible replacements of diagram's prototype functions as in following post, and update the script for new API -

https://mindfusion.eu/Forum/YaBB.pl?num=1367227880/1#1

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #6 - Jan 8th, 2025 at 9:04am
Print Post  
Actually our developers fixed something image.src related between 4.2 and 4.3 releases. Try attached script, it's a copy of the 4.2 diagramming.js with the fix patched in.

Regards,
Slavcho
Mindfusion
  

MindFusion_Diagramming_js.zip ( 583 KB | 2 Downloads )
Back to top
 
IP Logged
 
klaatutrout
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Oct 26th, 2021
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #7 - Jan 8th, 2025 at 4:11pm
Print Post  
Using the later JS file got me past the .src error, but I'm now experiencing issues with the diagram disappearing after being (briefly) displayed.  (There are no errors in the debug console, nor are there any errors on the network tab.)

If I step through the document.ready() function, I see the various shapes getting drawn (e.g., links, nodes, labels, images, etc.), but at some point the diagram disappears when stepping through the MindFusion.Diagramming.js code at the following location (I have a breakpoint set on the highlighted line below):

Code
Select All
S.ajaxTransport(function(i) {
        var o, a;
        if (v.cors || zt && !i.crossDomain)
            return {
                send: function(e, t) {
                    var n, r = i.xhr();
                    if (r.open(i.type, i.url, i.async, i.username, i.password),
                    i.xhrFields)
                        for (n in i.xhrFields)
                            r[n] = i.xhrFields[n];
                    for (n in i.mimeType && r.overrideMimeType && r.overrideMimeType(i.mimeType),
                    i.crossDomain || e["X-Requested-With"] || (e["X-Requested-With"] = "XMLHttpRequest"),
                    e)
                        r.setRequestHeader(n, e[n]);
                    o = function(e) {
                        return function() {
                            o && (o = a = r.onload = r.onerror = r.onabort = r.ontimeout = r.onreadystatechange = null,
                            "abort" === e ? r.abort() : "error" === e ? "number" != typeof r.status ? t(0, "error") : t(r.status, r.statusText) : t(_t[r.status] || r.status, r.statusText, "text" !== (r.responseType || "text") || "string" != typeof r.responseText ? {
                                binary: r.response
                            } : {
                                text: r.responseText
                            }, r.getAllResponseHeaders()))
                        }
                    }
                    ,
                    r.onload = o(),
                    a = r.onerror = r.ontimeout = o("error"),
                    void 0 !== r.onabort ? r.onabort = a : r.onreadystatechange = function() {
                        4 === r.readyState && C.setTimeout(function() {
                            o && a()
                        })
                    }
                    ,
                    o = o("abort");
                    try {
                        r.send(i.hasContent && i.data || null)
                    } catch (e) {
                        if (o)
                            throw e
                    }
                },
                abort: function() {
                    o && o()
                }
            }
    }),
 



NOTE:  It consistently disappears after the 5th time hitting that breakpoint.

This happens regardless of whether I have any shapes on the diagram.  (I've tried with both existing diagrams and blank [new] diagrams.)

I'm going to investigate further, but if you have any suggestions, I'm open to whatever insight you might offer.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #8 - Jan 8th, 2025 at 8:16pm
Print Post  
Please check the canvas element size. If it's larger than a couple of thousands pixels, make sure DiagramView.virtualScroll is enabled.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #9 - Jan 9th, 2025 at 7:50am
Print Post  
What ASP.NET MVC version are you using? We can't reproduce problems in an MVC 5 project. If you attach a test project demonstrating that, our developer will investigate.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
klaatutrout
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Oct 26th, 2021
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #10 - Jan 9th, 2025 at 2:26pm
Print Post  
I'll see if I can come up with a project and send it your way.  (The project in question is part of an enterprise application and it's not really feasible to send your way!)

We're using MVC5 (5.2.9.0) against .NET Framework 4.8.

For kicks, I reverted to the original version and then upgraded to 3.3.0 and encountered the same issues, so I'm pretty sure it's on my end, it's just a matter of figuring out what's causing the issue.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #11 - Jan 9th, 2025 at 3:20pm
Print Post  
Release log shows a lot of virtual-scroll related changes between v3.2.2 and v3.3, so the problem could be caused by some incompatibility between the CSS grid layout used for it and the page layout of your app. Maybe check if disabling VirtualScroll makes things better.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
klaatutrout
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Oct 26th, 2021
Re: Errors after upgrading from 3.2.2 to 4.2.0
Reply #12 - Jan 9th, 2025 at 10:08pm
Print Post  
Based on your last reply, I went ahead with updating to 4.2.x and have been successful in getting the map to display by commenting out legacy code.  I still haven't determined exactly what is causing it, but I'm making progress.  (I don't believe it had anything to do with the VirtualScroll, but I'm not positive.)

Thank you for all your responses and insight.  While nothing was definitive, it gave me the ideas necessary to move forward.

I'll update this once I finally figure out what the issue was so that others may benefit from my investigation.

Thanks again for your help!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint