SparkleXrm icon indicating copy to clipboard operation
SparkleXrm copied to clipboard

Custom API Earlybound code splitting incorrectly

Open MrCliffster opened this issue 3 years ago • 1 comments

Problem: When generating Earlybound classes including Custom APIs the Custom API files are incomplete

After running earlybound.bat, spkl successfully generates the full suite of directories and files for Entities, Actions, and OptionSets as shown: image However, the class files for the individual Custom API actions are badly formed: image The key issue is the badly formed string on line 3, which is actually part of the serialisation attributes that crmsvcutil generates as shown on line 10453 in the monolithic file: image

Suspected Cause

The regex that splits classes in CodeSplitter.cs is not correctly able to deal with the schema being provided by crmsvcutil as part of the DataContractAttribute shown in the third screenshot above. The schema namespace Namespace="http://schemas.microsoft.com/xrm/2011/new/" is unique to these Custom APIs in the monolithic EarlyBoundTypes.cs file that the tool outputs. I think a fix to the regex in Spkl's SourceCodeTypeExtractor.cs located here, specifically the ClassRegex, should alleviate this problem.

MrCliffster avatar Mar 21 '22 00:03 MrCliffster

For those that stumble across this issue, the temporary workaround I use is to manually copy-paste the line that is broken into each custom action, each time I generate EBG files. The line is: [System.Runtime.Serialization.DataContractAttribute(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]

MrCliffster avatar May 05 '22 05:05 MrCliffster