How to resolve System.TypeInitializationException?

1

I have a static class

namespace Metropolitano
{
public static class Rutas
{
    public static SAlimentadora AlimentadoraSur = new SAlimentadora();
    private static BAlimentador Cedros02 = new BAlimentador();
    private static BAlimentador Villa04 = new BAlimentador();
    private static BAlimentador America07 = new BAlimentador();
    private static BAlimentador Proceres08 = new BAlimentador();
    private static BAlimentador busTest = new BAlimentador();
    public static SAlimentadora AlimentadoraNorte = new SAlimentadora();

    static Rutas()
    {
            AlimentadoraSur.Estaciones = new[]
            {
            //AS-02 Cedros de Villa 0-10
            "Terminal Matellini", "Huaylas", "Alameda Sur", "Los Pinos",
            "Plaza Vea", "Las Camelias",
            "Cedros de Villa", "Ballestas", "España", "Aruba",
             .
             .
             .

And when I run, it bounces

  

System.TypeInitializationException "An exception occurred in the   type initializer of 'Metropolitano.Rutas'. "

private void Form1_Load(object sender, EventArgs e)
    {
        cmbDestinoAS.Enabled = false;
        for (int i = 0; i < **AlimentadoraSur.Estaciones.Length**; i++) //El error ocurre aqui
        {
            cmbInicioAS.Items.Add($"{i}-{AlimentadoraSur.Estaciones[i]}");
            cmbDestinoAS.Items.Add($"{i}-{AlimentadoraSur.Estaciones[i]}");
        }
    }

I have already debugged but I did not find anything and I read that it can be resolved with a try catch but it does not work either. How do I make that error disappear?

    
asked by Isaac 20.10.2016 в 19:16
source

0 answers