Infinite Loop in void checkcard (memory game)

Class GameManager

public Sprite[] cardface;
public Sprite cardback;
public GameObject[] cards;
public Text matchText;

private bool _init = false;
private int  _matches = 5;

private void Update(){
    if (!_init)
        initializeCards();

    if (Input.GetMouseButtonUp(0))
        CheckCards();
}
void initializeCards(){
    for(int id = 0; id < 2; id++){
        for(int i = 1; id <6; i++){

            bool test = false;
            int choice = 0;
            while(!test){
                choice = Random.Range(0, cards.Length);
                test = !(cards[choice].GetComponent<Card> ().inicializado);
            }
            cards[choice].GetComponent<Card>().cardValue = i;
            cards[choice].GetComponent<Card>().inicializado = true;
        }
    }

    foreach (GameObject c in cards)
        c.GetComponent<Card>().setupgraphics();

    if (!_init)
        _init = true;
}
public Sprite getCardBack(){
    return cardback;

}
public Sprite getCardFace(int i){
    return cardface [ i - 1 ];
}

void CheckCards() {
    List<int> c = new List<int>();

    for(int i = 0; i < cards.Length; i++){
        if (cards*.GetComponent<Card>().state == 1)*

c.Add(i);
}
if (c.Count == 2)
cardComparison(c);
}
void cardComparison(List c){
Card.Nao_fazer = true;
int x = 0;
if(cards[c[0]].GetComponent().cardValue == cards[c[1]].GetComponent().cardValue){
x = 2;
_matches–;
matchText.text = “Combinações Restantes:” + _matches;
if (_matches == 0)
SceneManager.LoadScene(“Menu”);
}
for(int i = 0; i < c.Count; i++){
cards[c*].GetComponent().state = x;*
cards[c*].GetComponent().falseCheck();*
}
}
Class Card
public static bool Nao_fazer = false;
[SerializeField]
private int _state;
[SerializeField]
private int _cardValue;
[SerializeField]
private bool _inicializado = false;
private Sprite _cardback;
private Sprite _cardface;
private GameObject _manager;
private void Start()
{
_state = 1;
_manager = GameObject.FindGameObjectWithTag(“Manager”);
}
public void setupgraphics()
{
_cardback = _manager.GetComponent().getCardBack();
_cardface = _manager.GetComponent().getCardFace(_cardValue);
flipCard();
}
public void flipCard(){
if (_state == 0)
_state = 1;
else if (_state == 1)
_state = 0;
if (_state == 0 && Nao_fazer)
GetComponent().sprite = _cardback;
else if(_state == 1 && !Nao_fazer)
GetComponent().sprite = _cardface;
}
public int cardValue{
get { return _cardValue; }
set { _cardValue = value; }
}
public int state{
get { return _state; }
set { _state = value; }
}
public bool inicializado{
get { return _inicializado; }
set { _inicializado = value; }

}
public void falseCheck(){
StartCoroutine(pause());
}
IEnumerator pause(){
yield return new WaitForSeconds(1);
if (_state == 0)
GetComponent().sprite = _cardback;
else if( _state == 1 )
GetComponent().sprite = _cardface;
Nao_fazer = false;
}

}

void initializeCards() {
for (int id = 0; id < 2; id++) {
for (int i = 1; id < 6; i++) { // Here. ‘id’ is always less than 6.

Also, this while statement seems very dangerous. Are you sure it always ends up with test being true in the end? Because, as I see, this loop is always going to repeat itself.

while(!test){
    choice = Random.Range(0, cards.Length);
    test = !(cards[choice].GetComponent<Card> ().inicializado);
}
cards[choice].GetComponent<Card>().cardValue = i;
cards[choice].GetComponent<Card>().inicializado = true;