title: Cannot use __try in functions that require object unwinding fix
body: <p>I've got this loop here for a game bot which requires a __try __except to prevent insta-crashing when the code is injected. However, I'm getting the error: <code>Cannot use __try in functions that require object unwinding fix</code>.</p>
  
  <p>I've looked through all function calls inside of this function, and not a single one of them contain a nested __try __except and I'm also building with /EHs. </p>
  
  <p>Here's my code;</p>
  
  <pre><code>void bot::logic::loop()
  {
      while (true)
      {
          __try
          {
              if (bot::logic::should_close())
                  exit(33062);
  
              om::refresh_minions();
  
              if (local_player::is_threatened())
                  local_player::handle_threat();
  
              if (local_player::is_in_turret())
              {
                  utils::move_to_suitable_pos();
                  std::this_thread::sleep_for(12s);
              }
  
              object* localplayer = obj_local_player;
              bot::logic::calculate_buys(localplayer-&gt;current_gold);
  
              obj_manager* manager = (obj_manager*)(m_base + o_obj_manager);
              for (int32_t i = 0; i &lt; manager-&gt;highest_index; i++)
              {
                  object* this_object = manager-&gt;ptrs[i];
  
                  if (this_object)
                  {      
                      if (is_minion(this_object) == 3073)
                          if (local_player::object_is_enemy(this_object))
                              if (utils::is_object_mid(this_object))
                                  if (is_alive(this_object) == TRUE)
                                      utils::Log("all passed");
  
                      if (local_player::object_is_enemy(this_object) &amp;&amp; utils::is_object_mid(this_object) &amp;&amp; is_alive(this_object) == TRUE &amp;&amp; is_minion(this_object) == 3073)
                      {
                          object* enemy_minion = this_object;
  
                          for (int i = 0; i &lt; game::minion_maxed_index; i++)
                          {
                              bot::logic::moving_to_cs_loop(om_ally_minions[i].minion_object, enemy_minion);
                              bot::logic::csing_loop();
                          }
                      }
                  }
              }
              std::this_thread::sleep_for(100ms);
          }
          __except (EXCEPTION_EXECUTE_HANDLER) {};
      }
  }
  </code></pre>
  
  <p>Can anyone tell me which objects 'require unwinding' and how I can prevent this error?</p>
  
  <p>EDIT: I've found the error occurs within the code;</p>
  
  <pre><code>if (is_minion(this_object) == 3073)
      if (local_player::object_is_enemy(this_object))
          if (utils::is_object_mid(this_object))
              if (is_alive(this_object) == TRUE)
                  utils::Log("all passed");
  </code></pre>