mercredi 3 novembre 2021

Reflection - Programm Crash without ErrorMessage

       {
           Assembly the = Assembly.GetAssembly(typeof(MonoBehaviourPublicObmaSkObInveVecuGaVeUnique));
           List<string> res = new List<string>();
           foreach(Type AllTypes in the.GetTypes())
           {
               res.Add(AllTypes.Name);
           }
           return res;
       }

Here I get all the classes first.

       public static List<PropertyInfo> getAllInfos(string ClassName)
       {
           try
           {
               Assembly the = Assembly.GetAssembly(typeof(MonoBehaviourPublicObmaSkObInveVecuGaVeUnique));
               foreach (Type classType in the.GetTypes())
               {
                   if (classType.Name == ClassName)
                   {
                       PropertyInfo[] allInfos = classType.GetProperties(BindingFlags.Public | BindingFlags.Static);
                       return allInfos.ToList();
                   }
               }
               return null;
           }catch(Exception message)
           {
               MelonLogger.Error(message);
               return null;
           }
          
       } 

Then I get all the property information for the selected class

When I get the information about the classes, the program crashes without a message <- this is a Picture.

When I get information about some classes (outlined in red) the program crashes without a message.

How can I open or lock such a class.





Aucun commentaire:

Enregistrer un commentaire