daryllabar / DLaB.Xrm.XrmToolBoxTools

Plugins for the XrmToolBox
MIT License
78 stars 70 forks source link

Early Bound Generator V2 - Error generating classes #480

Closed Harl3 closed 10 months ago

Harl3 commented 10 months ago

Tool and Version What tool/version is it that you're reporting a bug for? i.e. EarlyBoundGenerator V2 2.2023.12.2022

Describe the bug Suddenly i'm not able to generate classes anymore using settings that always worked up until last month, for every environment i have and i'm getting a null reference exception. i have also tried to completely reinstall and reconfigure XrmToolbox and EarlyBoundGenerator V2 but i'm seeing the same error. Also tried to downgrade the tool to no avail.

To Reproduce Steps to reproduce the behavior:

  1. Connect Early Bound Generator V2 to a Dataverse environment
  2. Click on 'Generate'
  3. See the error:
  4. [ 0: Information ] - Dataverse Model Builder : [Version 2.0.0.6] [ 0: Information ] - © 2022 Microsoft Corporation. All rights reserved [ 0: Information ] - [ 0: Information ] - Begin reading metadata from MetadataProviderService [ 0: Information ] - Looking for custom extension named DLaB.ModelBuilderExtensions.CodeWriterFilterService,DLaB.ModelBuilderExtensions for [ 0: Information ] - Looking for custom extension named DLaB.ModelBuilderExtensions.CodeWriterMessageFilterService,DLaB.ModelBuilderExtensions for [ 0: Information ] - Looking for custom extension named DLaB.ModelBuilderExtensions.MetadataProviderService,DLaB.ModelBuilderExtensions for [ 0: Information ] - Looking for custom extension named DLaB.ModelBuilderExtensions.MetadataQueryProviderService,DLaB.ModelBuilderExtensions for [ 0: Information ] - Looking for custom extension named DLaB.ModelBuilderExtensions.CodeGenerationService,DLaB.ModelBuilderExtensions for [ 0: Information ] - Looking for custom extension named DLaB.ModelBuilderExtensions.NamingService,DLaB.ModelBuilderExtensions for [ 0: Information ] - Looking for custom extension named DLaB.ModelBuilderExtensions.CustomizeCodeDomService,DLaB.ModelBuilderExtensions for [ 0: Information ] - Begin Reading Metadata from Server [ 0: Information ] - Read 23 Entities - 00:00:02.601 [ 0: Information ] - Read 0 Global OptionSets - 00:00:00.001 [ 0: Information ] - Read 1685 SDK Messages - 00:00:06.456 [ 0: Information ] - Completed Reading Metadata from Server - 00:00:09.124 [ 0: Information ] - Completed reading metadata from MetadataProviderService - 00:00:09.241 [ 0: Information ] - Begin Writing Code Files [ 0: Information ] - Processing 23 Entities System.Reflection.TargetInvocationException: Eccezione generata dalla destinazione di una chiamata. ---> System.NullReferenceException: Riferimento a un oggetto non impostato su un'istanza di oggetto. [ 0: Error ] - Exiting program with exit code 2 due to exception : System.Reflection.TargetInvocationException: Eccezione generata dalla destinazione di una chiamata. ---> System.NullReferenceException: Riferimento a un oggetto non impostato su un'istanza di oggetto. in DLaB.ModelBuilderExtensions.NamingService.<>c__DisplayClass73_0.b__0(LocalizedLabel l) in System.Linq.Enumerable.WhereListIterator1.MoveNext() in DLaB.ModelBuilderExtensions.NamingService.GetDefaultNameForOptionWithLabelReplacements(OptionSetMetadataBase metadata, IServiceProvider services, OptionMetadata option) in DLaB.ModelBuilderExtensions.NamingService.GetPossiblyDuplicateNameForOption(OptionSetMetadataBase metadata, IServiceProvider services, OptionMetadata option) in DLaB.ModelBuilderExtensions.NamingService.GetNameForOption(OptionSetMetadataBase optionSetMetadata, OptionMetadata optionMetadata, IServiceProvider services) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildOption(OptionSetMetadataBase optionSet, OptionMetadata option, ServiceProvider serviceProvider, List1 optionsNameList) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildOptionSetEnumType(EntityMetadata entity, OptionSetMetadataBase optionSet, ServiceProvider serviceProvider) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildAttributeOptionSet(EntityMetadata entity, AttributeMetadata attribute, CodeTypeMember attributeMember, ServiceProvider serviceProvider, Boolean useLegacyMode) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildEntity(EntityMetadata entity, ServiceProvider serviceProvider, Boolean useLegacyMode) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildEntities(EntityMetadata[] entityMetadata, ServiceProvider serviceProvider, Boolean useLegacyMode, Int32& processedCount) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildCodeDom2(IOrganizationMetadata organizationMetadata, String outputNamespace, ServiceProvider serviceProvider, String language, Boolean useLegacyMode) --- Fine della traccia dello stack dell'eccezione interna --- in System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) in System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) in System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in DLaB.ModelBuilderExtensions.PacModelBuilderCodeGenHack.InvokeMicrosoft_PowerPlatform_Dataverse_ModelBuilderLib_NonPublicStaticMethod(String methodName, Object[] parameters) in DLaB.ModelBuilderExtensions.PacModelBuilderCodeGenHack.CodeGenerationService_BuildCodeDom2(IOrganizationMetadata organizationMetadata, String outputNamespace, IServiceProvider serviceProvider, String language, Boolean useLegacyMode) in DLaB.ModelBuilderExtensions.PacModelBuilderCodeGenHack.Write(IOrganizationMetadata organizationMetadata, String language, String outputFile, String outputNamespace, IServiceProvider serviceProvider) in DLaB.ModelBuilderExtensions.CodeGenerationService.WriteInternal(IOrganizationMetadata organizationMetadata, String language, String outputFile, String targetNamespace, IServiceProvider services) in DLaB.ModelBuilderExtensions.CodeGenerationService.Write(IOrganizationMetadata organizationMetadata, String language, String outputFile, String outputNamespace, IServiceProvider services) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.ModelBuilder.WriteCode(IOrganizationMetadata organizationMetadata) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.ModelBuilder.Run() in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.ModelBuilder.Invoke(IOrganizationService serviceClient) [ 0: Error ] - ===== DETAIL ====== [ 0: Error ] - Source : mscorlib Method : InvokeMethod Date : 16:48:26 Time : 23/01/2024 Error : Eccezione generata dalla destinazione di una chiamata. Stack Trace : in System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) in System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) in System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in DLaB.ModelBuilderExtensions.PacModelBuilderCodeGenHack.InvokeMicrosoft_PowerPlatform_Dataverse_ModelBuilderLib_NonPublicStaticMethod(String methodName, Object[] parameters) in DLaB.ModelBuilderExtensions.PacModelBuilderCodeGenHack.CodeGenerationService_BuildCodeDom2(IOrganizationMetadata organizationMetadata, String outputNamespace, IServiceProvider serviceProvider, String language, Boolean useLegacyMode) in DLaB.ModelBuilderExtensions.PacModelBuilderCodeGenHack.Write(IOrganizationMetadata organizationMetadata, String language, String outputFile, String outputNamespace, IServiceProvider serviceProvider) in DLaB.ModelBuilderExtensions.CodeGenerationService.WriteInternal(IOrganizationMetadata organizationMetadata, String language, String outputFile, String targetNamespace, IServiceProvider services) in DLaB.ModelBuilderExtensions.CodeGenerationService.Write(IOrganizationMetadata organizationMetadata, String language, String outputFile, String outputNamespace, IServiceProvider services) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.ModelBuilder.WriteCode(IOrganizationMetadata organizationMetadata) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.ModelBuilder.Run() in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.ModelBuilder.Invoke(IOrganizationService serviceClient)

    Inner Exception Level 1 : Source : DLaB.ModelBuilderExtensions Method : b0 Date : 16:48:26 Time : 23/01/2024 Error : Riferimento a un oggetto non impostato su un'istanza di oggetto. Stack Trace : in DLaB.ModelBuilderExtensions.NamingService.<>cDisplayClass73_0.b__0(LocalizedLabel l) in System.Linq.Enumerable.WhereListIterator1.MoveNext() in DLaB.ModelBuilderExtensions.NamingService.GetDefaultNameForOptionWithLabelReplacements(OptionSetMetadataBase metadata, IServiceProvider services, OptionMetadata option) in DLaB.ModelBuilderExtensions.NamingService.GetPossiblyDuplicateNameForOption(OptionSetMetadataBase metadata, IServiceProvider services, OptionMetadata option) in DLaB.ModelBuilderExtensions.NamingService.GetNameForOption(OptionSetMetadataBase optionSetMetadata, OptionMetadata optionMetadata, IServiceProvider services) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildOption(OptionSetMetadataBase optionSet, OptionMetadata option, ServiceProvider serviceProvider, List1 optionsNameList) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildOptionSetEnumType(EntityMetadata entity, OptionSetMetadataBase optionSet, ServiceProvider serviceProvider) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildAttributeOptionSet(EntityMetadata entity, AttributeMetadata attribute, CodeTypeMember attributeMember, ServiceProvider serviceProvider, Boolean useLegacyMode) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildEntity(EntityMetadata entity, ServiceProvider serviceProvider, Boolean useLegacyMode) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildEntities(EntityMetadata[] entityMetadata, ServiceProvider serviceProvider, Boolean useLegacyMode, Int32& processedCount) in Microsoft.PowerPlatform.Dataverse.ModelBuilderLib.CodeGenerationService.BuildCodeDom2(IOrganizationMetadata organizationMetadata, String outputNamespace, ServiceProvider serviceProvider, String language, Boolean useLegacyMode)

    An error when calling ProcessModelInvoker.Invoke. Result: 2 System.Speech.Internal.Synthesis.AudioException: Errore del dispositivo audio. - Error Code: 0x2 in System.Speech.Internal.Synthesis.VoiceSynthesis.Speak(Prompt prompt) in DLaB.EarlyBoundGeneratorV2.Logic.Speak(String words) in DLaB.EarlyBoundGeneratorV2.Logic.Create(IOrganizationService service) in DLaB.EarlyBoundGeneratorV2.EarlyBoundGeneratorPlugin.b__49_0(BackgroundWorker w, DoWorkEventArgs e) System.Speech.Internal.Synthesis.AudioException: Errore del dispositivo audio. - Error Code: 0x2 in System.Speech.Internal.Synthesis.VoiceSynthesis.Speak(Prompt prompt) in DLaB.EarlyBoundGeneratorV2.Logic.Speak(String words) in DLaB.EarlyBoundGeneratorV2.Logic.Create(IOrganizationService service) in DLaB.EarlyBoundGeneratorV2.EarlyBoundGeneratorPlugin.b__49_0(BackgroundWorker w, DoWorkEventArgs e)

Expected behavior Being able to generate the early bound classes without issues

Screenshots image

Additional context I'm also attaching the settings file if it can be useful, i've just edited the extension from .xml to .txt SettingsEarlyBoundGeneratorV2.txt

daryllabar commented 10 months ago

Thanks for the bug submisison! Can you try closing down the XTB, and replacing the DLaB.ModelBuilderExtensions.dll in the XTB Plugins/DLaB.EarlyBoundGeneratorV2 folder with the dll in this zip? DLaB.ModelBuilderExtensions.zip

Harl3 commented 10 months ago

DLaB.ModelBuilderExtensions.Log.txt Hi! i've tried it but unfortunately i'm getting the same error. here is the log file attached. Please let me know if you want me to try something else or if i can help you debug this in any other way

daryllabar commented 10 months ago

You feel up to downloading and building the respository, attaching the debugger to the XTB, and running it?

daryllabar commented 10 months ago

image

Harl3 commented 10 months ago

Sure i can try that! i'll do anything i can to helo you resolve this as i'm really stuck in some work :)

Harl3 commented 10 months ago

hmm i can't seem to be able to build the project as i have several mismatches of nugets and .net (i had to update to 4.8) and unfortunately i'm not sure how to debug it from xtb. can you guide me in any way?

Harl3 commented 10 months ago

i've tried following this guide: https://www.xrmtoolbox.com/documentation/for-developers/debug/ but i am not able to debug the plugin as it won't even start, i must be doing something fundamentally wrong here, i'm sorry

daryllabar commented 10 months ago

hit me up on twitter or Linked in or something where we can message

Harl3 commented 10 months ago

i've messaged you on linkedin, thanks!