Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

"attempted to access an element as a type incompatible with the array" is a false statement...

Discussion in 'Programming Questions and Suggestions' started by happyjack27, Feb 11, 2015.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. happyjack27 Apprentice Engineer

    Messages:
    452
    i get an "attempted to access an element as a type incompatible with the array" exception when running this:

    Code:
    public class gyro_direction {  
            ...
      public static gyro_direction[] rollPitchYaw;
            ...
            public void calibrate(IMyGridTerminalSystem grid) {
                  ....
                  rollPitchYaw = new gyro_direction[3];
                  gyro_direction g = new gyro_direction("Roll");
                  rollPitchYaw[0] = g; //this line throws the exception!
                  ....
            }
    }
    
    any ideas on how to fix?

    i know there's the phrase, "if it ain't broke, don't fix it.", and it isn't broke, but you know i'd like it to work.
     
    Last edited by a moderator: Feb 11, 2015
  2. happyjack27 Apprentice Engineer

    Messages:
    452
    things i have tried that didn't work:

    * moving the declaration of rollpitchyaw outside of the class.
    * removing the custom constructor
    * using a List<> instead of an array.
    * all three of the above, together.
     
  3. happyjack27 Apprentice Engineer

    Messages:
    452
    okay, now i just removed the array or list altogether and just made a variable for each (rollPitchYaw0, 1, and 2).

    now i'm getting a common language runtime detected invalid program.

    here's the full code:

    Code:
     
        
    void Main() {   
      gyro_direction.calibrate(GridTerminalSystem);   
    }   
     
    
    public static List<IMyTerminalBlock>[] thrusters_0 = new List<IMyTerminalBlock>[]{new List<IMyTerminalBlock>(),new List<IMyTerminalBlock>(),new List<IMyTerminalBlock>()};       
    public static List<IMyTerminalBlock>[] thrusters_1 = new List<IMyTerminalBlock>[]{new List<IMyTerminalBlock>(),new List<IMyTerminalBlock>(),new List<IMyTerminalBlock>()};       
    public static String block_prefix = "";
    public static void debug(IMyGridTerminalSystem grid, string s) { 
      List<IMyTerminalBlock> wplBlocks = new List<IMyTerminalBlock>();      
      grid.SearchBlocksOfName(block_prefix+"GYRO DEBUG",wplBlocks);    
      if(wplBlocks.Count <= 0) { return; } 
      wplBlocks[0].SetCustomName(block_prefix+"GYRO DEBUG"+": "+s); 
    } 
      
      
    public class gyro_direction {  
        
      Vector3D ship_axis_deltas; //rotate forward (roll), rotate left (pitch), rotate up (yaw)  
      double angleDeltaPerRev = 0;  
      public string name = "";  
      
      public static IMyGridTerminalSystem grid;  
      public static gyro_direction rollPitchYaw0;
      public static gyro_direction rollPitchYaw1;
      public static gyro_direction rollPitchYaw2;
      
      public static double pre_smoothing_multiplier = 0.5;  
      public static double smoothing_multiplier = 0.5;  
      public static List<IMyTerminalBlock> gyros = new List<IMyTerminalBlock>();  
        
      public static int calibrate_index = 0;  
      public static int calibrate_tick = 0;  
      
      public static DateTime lastTime = DateTime.Now;    
      public static DateTime timeNow = DateTime.Now;    
        
      public static Vector3D[] last_orient = new Vector3D[3];  
      public static double calibrate_rpm = 10;  
      public static bool booting = true;  
      public static bool calibrated = false;  
        
      public gyro_direction(string s) {  
        name = s;  
      }  
      
        //assumes all vectors are normalized!  
      public double getMagnitudeImprovement(Vector3D[] current, Vector3D[] target, double revs) {  
        double currentDelta = getTotalAngleDelta(current,target);  
        double newDelta = getTotalAngleDelta(applyRPM(current,revs),target);  
        double improvement = currentDelta-newDelta;  
        return improvement;  
      }  
        
      //assumes all vectors are normalized!  
      public void calcAffect(Vector3D[] previous, Vector3D[] current, double revs) {
        debug(grid,"calcAffect {");
      //store angledelta about forward,left,up vectors, sum of all vectors (except the vector we are rotating about)  
        for(int iaxis = 0; iaxis < 3; iaxis++) {  
          double amt = 0;  
          for(int jaxis = 0; jaxis < 3;  jaxis++) {  
            if( jaxis == iaxis) continue;  
            Vector3D axis = current[jaxis].Cross(previous[jaxis]);  
            axis = axis / axis.Length(); 
            double angle = current[jaxis].Dot(previous[jaxis]);  
            double sign = previous[iaxis].Dot(axis) > Math.PI/2.0 ? -1 : 1;  
            amt += angle*sign*0.5;  
          }  
          amt /= revs;  
          ship_axis_deltas.SetDim(iaxis,amt);  
        }  
        angleDeltaPerRev = ship_axis_deltas.Length();  
        debug(grid,"calcAffect }");
      }  
      
      //assumes all vectors are normalized!    
      public Vector3D[] applyRPM(Vector3D[] current, double revs) {  
        debug(grid,"applyRPM {");
      
        Vector3D[] result = new Vector3D[3];  
        Vector3D zvec = new Vector3D(0,0,0);  
        for( int i = 0; i < 3; i++) {  
          result[i] = zvec+current[i];  
        }  
          
        for(int iaxis = 0; iaxis < 3; iaxis++) {  
          var matTransform = Matrix.CreateFromAxisAngle( current[iaxis], (float)ship_axis_deltas.GetDim(iaxis) );   
          for(int jaxis = 0; jaxis < 3; jaxis++) {  
            result[jaxis] = Vector3D.Transform( result[jaxis], matTransform );  
          }  
        }  
        debug(grid,"applyRPM }");    
        return result;  
      }  
      public static void calibrate(IMyGridTerminalSystem grid) {  
        debug(grid,"calibrate { "+calibrate_index+" "+calibrate_tick);    
        timeNow = DateTime.Now;    
        if( booting) {  
          debug(grid,"boot 0");    
          //rollPitchYaw = new gyro_direction[3];
          debug(grid,"boot 1");    
          rollPitchYaw0 = new gyro_direction("Roll"); 
          rollPitchYaw1 = new gyro_direction("Pitch");  
          rollPitchYaw2 = new gyro_direction("Yaw"); 
          debug(grid,"boot 2");    
          collectGyros(grid);  
          debug(grid,"boot 3");    
          booting = false;  
        }  
        if( calibrate_index < 3) {  
          gyro_direction.setGyros(  
            calibrate_index == 0 ? calibrate_rpm : 0,  
            calibrate_index == 1 ? calibrate_rpm : 0,  
            calibrate_index == 2 ? calibrate_rpm : 0 
          );  
          if(calibrate_tick == 0) {  
          } else   
          if(calibrate_tick == 4) {  
            debug(grid,"calibrate getnorms");    
            last_orient = getThrustNorms(grid);  
            lastTime = timeNow;  
          } else   
          if(calibrate_tick == 8) {  
            double deltat = (timeNow-lastTime).TotalMilliseconds;   
            Vector3D[] cur_orient = new Vector3D[3];
            switch(calibrate_index) {
              case 0:
                rollPitchYaw0.calcAffect(last_orient,cur_orient,deltat*calibrate_rpm);
                break;
              case 1:
                rollPitchYaw1.calcAffect(last_orient,cur_orient,deltat*calibrate_rpm);
                break;
              case 2:
                rollPitchYaw2.calcAffect(last_orient,cur_orient,deltat*calibrate_rpm);
                break;
            }
            //rollPitchYaw[calibrate_index].calcAffect(last_orient,cur_orient,deltat*calibrate_rpm);  
            calibrate_index++;  
            calibrate_tick = -1;  
          } else  { 
          }    
        } else {  
          calibrated = true;  
        }  
          
        calibrate_tick++;  
        debug(grid,"calibrate }");    
      }  
      
      public static void collectGyros(IMyGridTerminalSystem grid0) {
        debug(grid,"collectgyros {");    
        
        grid = grid0;  
        gyros = getBlockGroup(grid,"Gyros");  
        debug(grid,"collectgyros }");    
      }  
      public static void releaseGyros() {  
        for(int i = 0; i < gyros.Count; i++) {  
          IMyGyro gyro = (IMyGyro)gyros[i];  
          if( gyro.GyroOverride == true)        
             gyro.GetActionWithName("Override").Apply(gyro);   
         }       
      }  
      public static void setGyros(double roll, double pitch, double yaw) {  
        debug(grid,"setgyros3 {");    
      
        for(int i = 0; i < gyros.Count; i++) {  
          IMyGyro gyro = (IMyGyro)gyros[i];  
          if( gyro.GyroOverride == false)        
             gyro.GetActionWithName("Override").Apply(gyro);   
          gyro.SetValue<float>("Roll",(float)roll);  
          gyro.SetValue<float>("Pitch",(float)pitch);  
          gyro.SetValue<float>("Yaw",(float)yaw);  
        }  
        debug(grid,"setgyros3 }");    
      }  
      public static void setGyros( Vector3D[] target, double timeDelta) {  
        setGyros( getThrustNorms(grid), target, timeDelta);  
      }  
      public static void setGyros(Vector3D[] current, Vector3D[] target, double timeDelta) {  
        if( !calibrated) return;  
        double[] rpy = getRecommendedRPMs( current, target, timeDelta);  
        setGyros(rpy[0],rpy[1],rpy[2]);  
      }  
        
      public static double[] getRecommendedRPMs(Vector3D[] current, Vector3D[] target, double timeDelta) {  
        double targetAngleDelta = pre_smoothing_multiplier*getTotalAngleDelta(current,target)/timeDelta;  
        if( targetAngleDelta > Math.PI)  
          targetAngleDelta = Math.PI;  
      
        double[] improvement = new double[3];  
        improvement[0] = 0;  
        improvement[1] = 0;  
        improvement[2] = 0;  
        double[] revs = new double[3];  
        revs[0] = 0;  
        revs[1] = 0;  
        revs[2] = 0;  
          
        double sum = 0;  
        for( int i = 0; i < 3; i++) {  
          gyro_direction rollPitchYaw_;
          switch(i) {
            case 0:
              rollPitchYaw_ = rollPitchYaw0;
              break;
            case 1:
              rollPitchYaw_ = rollPitchYaw1;
              break;
            case 2:
              rollPitchYaw_ = rollPitchYaw2;
              break;
          }
          double target_revs = targetAngleDelta/rollPitchYaw_.angleDeltaPerRev;  
          double up = -1;   
          double down = -1;  
          while( up*down > 0) { //if same sign, then test is too high.  
            target_revs *= 0.5;  
            up = rollPitchYaw_.getMagnitudeImprovement(current, target, target_revs);  
            down = rollPitchYaw_.getMagnitudeImprovement(current, target, -target_revs);   
          }  
          revs[i] = target_revs;  
          improvement[i] = (up-down)/2.0;  
          sum += Math.Abs(improvement[i])/revs[i];  
        }  
        for( int i = 0; i < 3; i++) {  
          gyro_direction rollPitchYaw_;
          switch(i) {
            case 0:
              rollPitchYaw_ = rollPitchYaw0;
              break;
            case 1:
              rollPitchYaw_ = rollPitchYaw1;
              break;
            case 2:
              rollPitchYaw_ = rollPitchYaw2;
              break;
          }
          double revstry = (targetAngleDelta/rollPitchYaw_.angleDeltaPerRev)*(improvement[i]/revs[i])/sum;  
          double up = rollPitchYaw_.getMagnitudeImprovement(current, target, revstry);  
          while( up < 0) {  
            revstry *= 0.5;  
            up = rollPitchYaw_.getMagnitudeImprovement(current, target, revstry);  
          }  
          improvement[i] = smoothing_multiplier*revs[i] / timeDelta;  
        }  
        return improvement;  
      }
      
      public static double getTotalAngleDelta(Vector3D[] current, Vector3D[] target) {
        debug(grid,"getTotalAngleDelta {");    
      
        double delta = 0;  
        for(int i = 0; i < 3; i++) {  
          double d = current[i].Dot(target[i]);  
          delta += d*d;  
        }
        debug(grid,"getTotalAngleDelta }");    
        return Math.Sqrt(delta);  
      }  
    }  
     
    public static Vector3D[] getThrustNorms(IMyGridTerminalSystem grid) {   
      thrusters_0[0] = getBlockGroup(grid,block_prefix+"Thrust Forward");        
      thrusters_0[1] = getBlockGroup(grid,block_prefix+"Thrust Left");        
      thrusters_0[2] = getBlockGroup(grid,block_prefix+"Thrust Up");        
      thrusters_1[0] = getBlockGroup(grid,block_prefix+"Thrust Backward");        
      thrusters_1[1] = getBlockGroup(grid,block_prefix+"Thrust Right");        
      thrusters_1[2] = getBlockGroup(grid,block_prefix+"Thrust Down");        
          
      Vector3D[] thrustNorms = new Vector3D[]{         
        averagePosition(thrusters_1[0])-averagePosition(thrusters_0[0]),         
        averagePosition(thrusters_1[1])-averagePosition(thrusters_0[1]),         
        averagePosition(thrusters_1[2])-averagePosition(thrusters_0[2]),         
      };       
      for( int i = 0; i < 3; i++) {       
        thrustNorms[i] /= thrustNorms[i].Length();       
      }   
      return thrustNorms;   
    } 
     
    public static List<IMyTerminalBlock> getBlockGroup(IMyGridTerminalSystem grid, String name) {      
      for( int i = 0; i < grid.BlockGroups.Count; i++) {      
        if( grid.BlockGroups[i].Name == name) {      
          return grid.BlockGroups[i].Blocks;      
        }       
      }      
      return new List<IMyTerminalBlock>();      
    } 
          
    public static Vector3D averagePosition(List<IMyTerminalBlock> thrusters) {      
      Vector3D sum = new Vector3D(0,0,0);      
      for( int i = 0; i < thrusters.Count; i++) {      
        sum += thrusters[i].GetPosition();        
      }      
      return sum / (double)thrusters.Count;      
    }      
     
    
     
  4. happyjack27 Apprentice Engineer

    Messages:
    452
    i figured it out by starting with minimal code and adding in a piece at a time until it broke. it doesn't like the switch(int) for some reason. i replaced that with the below and it worked.

    Code:
            gyro_direction rollPitchYaw_ =  
              calibrate_index == 0 ? rollPitchYaw0 : 
              calibrate_index == 1 ? rollPitchYaw1 : 
              calibrate_index == 2 ? rollPitchYaw2 : 
              null; 
    
    
    seems like a bug in the compiler. i blame it on microsoft.
     
  5. Immersive Apprentice Engineer

    Messages:
    122
    You're forgetting that Keen are restricting language elements to prevent 'hacking' the game, which is understandable. The problem, at least this time, isn't with Microsoft.
     
  6. happyjack27 Apprentice Engineer

    Messages:
    452
    i don't see how making it so switch(int) doesn't work prevents hacking. any switch statment can simply be replaced with if-else's or a function dictionary or function array. and if you took away all those things - if you took away any ability to have flow control / conditional execution, then you'd be taking away scripting altogether.

    so the hypothesis that keen was restricting this element is not tenable -- unless you intend to argue that they are incompetent, and i believe they have already proved otherwise.

    so that leaves something broken with the compiler. and who wrote the compiler? i believe microsoft...

    i suppose it's also possible that turning something off had some inadvertent side effect. in which case they couldn't really be expected to have anticipated that side effect. so theres the 3rd possibility of an accident resulting form insufficient information.
     
    Last edited by a moderator: Feb 11, 2015
  7. Phoera Senior Engineer

    Messages:
    1,713
    i looked into internals of IGS, and i can say you how.(need to check deeply atm, may be i can fix it for my patches of SE)
    this all comes from instruction counting.
    Keen inserts this counter in our code.
    for the notice, IGS you the same compiler as MSVS, but in MSVS all works fine, so where is the fault?)
    you cannot disable feature of compiler, you can restrict assemblies only.
     
    Last edited by a moderator: Feb 11, 2015
  8. Immersive Apprentice Engineer

    Messages:
    122
    I'm certain that Keen did not intend to mangle the switch statement, or many of the other features we take for granted (like late-binding generics). I also doubt they spent a lot of time testing edge use cases since they have more important things they should be focused on. I'm not saying Keen's inept, I'm saying that the game's in Alpha. I'm also saying that it's an unintended side effect of how they're managing the scripting environment.
     
    Last edited by a moderator: Feb 11, 2015
  9. Malware Master Engineer

    Messages:
    9,861
    As a daily user of the C# language in a professional environment for many years (as, I believe, are the others responding to you in this thread) I can guarantee you that it has nothing to do with the C# compiler. Immersive is perfectly correct. And it has also nothing to do with Keen being inept or not knowing what they are doing, it has to do with them using the compiler and C# language in a way it was never indented. As phoenixcorp13 is indicating, this is not a hypothesis - it is a fact that Keen's script restriction system is affecting the switch. They are not restricting the switch per say, at least not intentionally, but the effect is still there.

    You really think that such an obvious compiler bug would survive the current lifetime of C#? Do you have any idea how many really, really complicated applications are made with C#? Not to mention Space Engineers itself? This statement makes no sense what so ever.

    So I have to wonder if you are just making fun of us... in which case we (at least I) took the bait, hook, line and sinker :D
     
  10. Igneous01 Apprentice Engineer

    Messages:
    266
    This is because of casting issues, exactly what type is rollPitchYaw?

    See this answer on stack overflow, as it is related and explains the issue:
    "You shouldn't have to specify the type argument for the <code style="color: #222222; line-height: 19.5px; margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; white-space: pre-wrap; background-color: #eeeeee;">ToArray</code> method, it should be inferred from it's usage, if you are using strongly typed collections. This is a generic type casting problem. You are trying to put elements in an array of some incompatible type.
    Your problem should boil to this (these arrays are covariant):
    <code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; white-space: inherit;">object[] obj =newstring[1];

    obj[0]=5;// compiles fine, yields runtime error</code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-size: 15px; clear: both; color: #222222; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; line-height: 19.5px;">Now, the same thing, with different types (these arrays are also covariant):
    <code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; white-space: inherit;">IEnumerable&lt;int>[] x =newList&lt;int>[1];

    x[0]=newint[1];// compiles fine, yields runtime error</code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-size: 15px; clear: both; color: #222222; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; line-height: 19.5px;">It should be obvious why the type system doesn't like this. Basically, you look at it as if it was an array of <code style="margin: 0px; padding: 1px 5px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; white-space: pre-wrap; background-color: #eeeeee;">IEnumerable&lt;int></code> but it's actually an array of <code style="margin: 0px; padding: 1px 5px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, sans-serif; white-space: pre-wrap; background-color: #eeeeee;">List&lt;int></code>. You can not put an unrelated type array of int, into that array."

    Its best to search for these sorts of things on stackoverflow, as people there give some very good and indepth reasons as to why something happens.

    Link is here: http://stackoverflow.com/questions/3412909/converting-a-list-to-an-array-i-get-attempted-to-access-an-element-as-a-typ
     
  11. Phoera Senior Engineer

    Messages:
    1,713
    Code:
    public static gyro_direction[] rollPitchYaw;
    new gyro_direction[3]
    
    ...

    there error from IGS realization. i have the same issue with lists.
     
  12. Immersive Apprentice Engineer

    Messages:
    122
    In general this is true but it's not always as clear-cut and apparent when using the scripting environment, again because of missing language features/namespaces/libraries, particularly in the case of late-binding generics/types, which I believe occur primarily when a class is self-referencing (although I'm a bit rusty on this topic).
     
    Last edited by a moderator: Feb 11, 2015
  13. happyjack27 Apprentice Engineer

    Messages:
    452
    that seems reasonable - that this is the 3rd case - an unintended side-effect.

    however if this is the case, then it should be noted that this implies that the compiler is set up in such a way that one could unintentionally break a switch statement on a primitive. regardless of whether or not it was used in an intended way. so it follows that the design of the compiler may not be entirely immune from fault; after all, it was designed in such a way that this was possible...

    my understanding is that there are two separate compilers here: that which compiles space engineers itself, and that which the space engineers executable uses at run-time to compile other code.

    the first has clearly seen much use, and the statement would face an improbability hurdle if refering to the first compiler. however, i am refering to the second compiler - a compiled executable compiling other code at run-time. presumably through an api of sorts. which is both more recursed and far less often used.

    the first situation should not be confused with the second.
    naw, just prodding, if you will. to try to figure it out. seems to be working... :D
     
    Last edited by a moderator: Feb 11, 2015
  14. Phoera Senior Engineer

    Messages:
    1,713
    editing executing instructions is not primitive.
    nope, it is the same.
     
  15. Malware Master Engineer

    Messages:
    9,861
    What they are probably doing (educated guess, phoenixcorp13 has done more in-depth research on this matter) is that they use the compiler (the one and only, as phoenixcorp13 also indicates) to compile your script, then they alter the final instruction language code to add in their restrictions. ANY language would in theory allow this, this is not specific to C#.

    You can't expect a compiler to protect from alteration to its finished product, can you? I mean a compiler is only translating the code from one language to another.
     
  16. Malware Master Engineer

    Messages:
    9,861
    I must add that I don't agree on Keen's method here though, I would rather have seen them using some sort of threading system so the scripts run in parallel to the game, then they wouldn't need to count instructions - and we would be able to have looping scripts which can handle their own state without the need of a timer. That would be beautiful, and much more immersive.

    Of course this kind of threading comes with its own set of challenges, but at least it is commonly done and far better than mangling C#.
     
  17. happyjack27 Apprentice Engineer

    Messages:
    452
    if that's what they are doing than i can see how that could break things. sounds kinda risky to fiddle with the byte code.

    i agree with your sentiments. i would add that if they want to protect people from making certain calls, well the way to do that is to control what interfaces you expose to that scope / package / what have you. it seems that access control should be done at the api level, and performance control at the thread level. any other mechanism i would think is both ineffective/incomplete if those mechanisms aren't, and furthermore are risks in themselves.

    i thought we were just going to be jailed at the api level and isolated at the thread and memory level. and that made sense. we shouldn't be able to create dangerous bytecode in the first place - at the compilation step.
     
    Last edited by a moderator: Feb 11, 2015
  18. Phoera Senior Engineer

    Messages:
    1,713
    they only need to make all checks correct. and make counter not disturb constructions.
    there is only two faults i see, but they can generate much errors for us.
     
  19. Phoera Senior Engineer

    Messages:
    1,713
    looked inside the problem with switches.

    looks like Keens second step compiler cannot handle them.
    they works only if was replaced by ifs. if they are natural switch, all ILs after switch instruction is broken.

    will look further.
     
  20. Malware Master Engineer

    Messages:
    9,861
    All that said though, I still blame Microsoft. Just by default :-D
     
  21. Immersive Apprentice Engineer

    Messages:
    122
    Would keen be better off using the Roslyn CTP instead of CodeDOM?
     
  22. CptTwinkie Master Engineer

    Messages:
    4,458
    I've been reading up about roslyn and codedom for the last 20 minutes. What struck me was how the problems we've been having with switch statements sound like they're caused directly by shortcomings in codedom. I wish I knew more about it frankly.
     
  23. Phoera Senior Engineer

    Messages:
    1,713
    what i call second step compiler(although i must call it loader) is only Keens works. and after this second step switch is broken, from MS compiler assembly is good.

    i can patch it as part of my game patches.

    but this only one error. second is reason of this topic.
    i dont look further, but i think i know the reason and here too.
     
    Last edited by a moderator: Feb 12, 2015
  24. Malware Master Engineer

    Messages:
    9,861
    phoenixcorp13, I know, it was a joke - like, I blame Microsoft even though they have nothing to do with this - just because they're Microsoft. :p I could just as easily have said that I blame Apple.

    Which I do.

    And while I have all respect for your obvious skills, I would personally never install a third-party patch as it would very likely break for any given update - plus I am way too paranoid :D. I would much rather have Keen fixing this themselves. I mean, their game isn't even finished yet. Please don't take offense to this.

    Hey, I'm one of the few who won't even install "proper" mods if I can avoid it.
     
    Last edited by a moderator: Feb 12, 2015
  25. Phoera Senior Engineer

    Messages:
    1,713
    that why i have written autopatcher for myself ^^

    i understand your position about third-party, this is your life, not mine, so you rule it:)
     
  26. CptTwinkie Master Engineer

    Messages:
    4,458
    Phoenixcorp13 if you have a working patch that maintains keen's restrictions then would you consider sharing it with them? Even if they only use it as a proof of concept it may be what's needed to remedy the problem on their end.
     
  27. Phoera Senior Engineer

    Messages:
    1,713
    i will make it after work, when i come home.
    for myself i will use it as part of my improvements experiment, but i will send diffs(for only this changing, i maintain every patch separate) to devs, and they can use it after.(if they will)
     
    Last edited by a moderator: Feb 12, 2015
  28. Phoera Senior Engineer

    Messages:
    1,713
    have no time before weekend to fix switches.
    tryed and make this fix.

    sent diffs of code in PM to three devs i first found.
    wait for answer.

    now will look at fixing custom types in collections error.
    (described in this topic)
     
    Last edited by a moderator: Feb 14, 2015
Thread Status:
This last post in this thread was made more than 31 days old.