Announcement

Collapse
No announcement yet.

Compiler error? Topological sort failing

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Compiler error? Topological sort failing

    I'm getting

    2019-07-24T10:55:50:776 Warning Topological sort failed with error System.InvalidOperationException: Cannot order this set of processes.

    The build continues but orders the output JS file in alphabetical order which obviously doesn't work.

    A reminder on the background here -- huge project. Say 10K classes. Up until now, we've had them divided into 7 projects. Each produced a separate JS file and meta.js file, and we included them all in the HTML. We are working on modularizing this. I'm not sure, but Jon Guy may have already been working with you on this. He started a proof of concept project using requirejs. However, he found in order for this to work, we were going to have to abandon our individual projects and combine all the Bridge.NET code into one assembly. We're now using Shared Projects for our 7 projects. Those projects are shared into two new projects, one called Bundled and one called Moduled. The bundled project exists only to serve as a safety net for our dev team whilie we're working out the kinks in the moduled version.

    Jon's PoC was small -- only a few dozen classes and 2 projects. I'm trying to take that PoC and apply it to the real solution. I have a Bundled project and 7 shared projects. When I share in the first 5 projects, everything builds fine. When I share in the 6th project, I get the above error. Based on what the code appears to be doing I think I either have some class duplication or some unresolvable circular reference?

    How would I go about solving this?

    I would be happy to share Jon's proof of concept with you. However, the real error is in our full solution and it would be quite difficult to share.

    Thanks,
    Kevin




    #2
    Hello Kevin!

    Thanks for letting us know of this problem.

    f that's happening, the topological sorting algorithm is getting loops in the dependency tree.

    On one hand, this may be happening because there's some dependency (and you then should have had issues with the C#-to-assembly building phase), before Bridge build mechanism is called. If that's the case, it might be working in "csc" by using a previously built part of the code, or something with potential errors risk.

    In the other hand, there is always the chance of a path (namespace/class/member) conflicting in the translated version, or just the reference. Maybe Bridge could be translating two individual entities into one (or the reference to different entities into a single one) that's resulting in a cycle.

    To trim down the chances, I believe it is necessary to analyze the list Bridge is trying to sort. Maybe turning on trace in the logs help. Otherwise, a rebuild of translator and perhaps stepping thru it and breaking execution at the time the exception is thrown (to analyze the stack) would be the way to go.

    I'm not sure this helps, but just for reference, this part of the TopologicalSorting library throws the exception you pointed: https://github.com/martindevans/Topo...cyGraph.cs#L79

    I'm not sure we can do much if the issue can't be reduced to some simplified project setup you could share (maybe even via a deck).

    Comment


      #3
      Oh, here's another: was the same project working with a previous Bridge version would you let us know last version it did, if so? Or was this introduced by the changes your're attempting to the project?

      Comment


        #4
        I will turn on trace and send you the output.

        It is building as separate "assemblies" in the same (latest) version of Bridge.NET.

        I'm working to see if I can get as far or farther with the Moduled version of the project. It's work in a forward direction, and it may actually shed some light. If it doesn't, then a separate test build of translator is the way I will go.

        Thx!

        Comment


          #5
          Just wanted to update and say we think we found the problem. I compiled our project from a locally built translator (with a local copy of the Topological sort) and identified a dozen classes that were stuck in the sort. We made a change to some of the generic type definitions and the problem went away. We will be trying to produce a sample for you to look at.

          Comment


            #6
            Awesome! Thanks for the help in making Bridge better, we're looking forward to it!

            Comment

            Working...
            X