diff --git a/src/FlatSharp.Compiler/CompilerOptions.cs b/src/FlatSharp.Compiler/CompilerOptions.cs index 6dcd3250..d57e277b 100644 --- a/src/FlatSharp.Compiler/CompilerOptions.cs +++ b/src/FlatSharp.Compiler/CompilerOptions.cs @@ -39,7 +39,7 @@ public record CompilerOptions public bool? NullableWarnings { get; set; } [Option("gen-poolable", Hidden = false, Default = false, HelpText = "EXPERIMENTAL: Generate extra code to enable object pooling for allocation reductions.")] - public bool? GeneratePoolableObjects { get; set; } + public bool GeneratePoolableObjects { get; set; } [Option("deserializers", Hidden = false, HelpText = "Specifies deserializers for FlatSharp to generate. Can help to reduce size of generated code.", Separator = ';')] public IList Deserializers @@ -59,6 +59,12 @@ public IList Deserializers } } + [Option("class-definitions-only", Hidden = false, HelpText = "Emits only class and data definitions. No serializers.")] + public bool ClassDefinitionsOnly { get; set; } + + [Option("input-files-only", Hidden = false, HelpText = "Only outputs type definitions for expicitely passed input files. Does not process any included files.")] + public bool SpecifiedFilesOnly { get; set; } + [Option("unity-assembly-path", HelpText = "Path to assembly (e.g. UnityEngine.dll) which enables Unity support.")] public string? UnityAssemblyPath { get; set; } diff --git a/src/FlatSharp.Compiler/FlatSharp.Compiler.targets b/src/FlatSharp.Compiler/FlatSharp.Compiler.targets index 4dbdc310..edc3cb8b 100644 --- a/src/FlatSharp.Compiler/FlatSharp.Compiler.targets +++ b/src/FlatSharp.Compiler/FlatSharp.Compiler.targets @@ -90,46 +90,50 @@ + + + + + + + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\tools\net6.0\FlatSharp.Compiler.dll')) + $(FlatSharpCompilerPath) + dotnet "$(CompilerPath)" --input "@(FlatSharpSchema)" --includes "$(Includes)" --output $(IntermediateOutputPath) + + + false true - - false + + + $(CompilerCommand) --nullable-warnings $(FlatSharpNullable) - - --deserializers "$(FlatSharpDeserializers)" + + $(CompilerCommand) --gen-poolable - - true + + $(CompilerCommand) --deserializers "$(FlatSharpDeserializers)" - - $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\tools\net6.0\FlatSharp.Compiler.dll')) + + $(CompilerCommand) --normalize-field-names $(FlatSharpNameNormalization) - - $(FlatSharpCompilerPath) + + $(CompilerCommand) --class-definitions-only - - - - - - dotnet "$(CompilerPath)" --nullable-warnings $(FlatSharpNullable) --normalize-field-names $(FlatSharpNameNormalization) --gen-poolable $(FlatSharpPoolable) --input "@(FlatSharpSchema)" --includes "$(Includes)" $(FlatSharpDeserializers) --output $(IntermediateOutputPath) + + $(CompilerCommand) --input-files-only - - - + + diff --git a/src/FlatSharp.Compiler/FlatSharpCompiler.cs b/src/FlatSharp.Compiler/FlatSharpCompiler.cs index ba67acf0..03ee3a0f 100644 --- a/src/FlatSharp.Compiler/FlatSharpCompiler.cs +++ b/src/FlatSharp.Compiler/FlatSharpCompiler.cs @@ -35,6 +35,8 @@ public class FlatSharpCompiler internal static CompilerOptions? CommandLineOptions { get; private set; } + private static readonly string RootDirectory = Path.GetDirectoryName(typeof(FlatSharpCompiler).Assembly.Location)!; + private static string AssemblyVersion => typeof(ISchemaMutator).Assembly.GetCustomAttribute()?.Version ?? "unknown"; [ExcludeFromCodeCoverage] @@ -108,7 +110,7 @@ private static int RunCompiler(CompilerOptions options) { try { - List bfbs = GetBfbs(options); + var bfbs = GetBfbs(options); string inputHash = ComputeInputHash(bfbs, options); @@ -230,7 +232,7 @@ private static bool IsInputUnchanged(string outputFullPath, string inputHash) } [ExcludeFromCodeCoverage] - private static string ComputeInputHash(List bfbs, CompilerOptions options) + private static string ComputeInputHash(List<(byte[] bfbs, string _)> bfbs, CompilerOptions options) { static void MergeHashes(byte[] hash, byte[] temp) { @@ -253,7 +255,7 @@ static void MergeHashes(byte[] hash, byte[] temp) // Merge each of the schema files. foreach (var schema in bfbs) { - MergeHashes(hashBytes, hash.ComputeHash(schema)); + MergeHashes(hashBytes, hash.ComputeHash(schema.bfbs)); } inputHash += "." + Convert.ToBase64String(hashBytes); @@ -268,7 +270,10 @@ internal static (Assembly, string) CompileAndLoadAssemblyWithCode( CompilerOptions options, IEnumerable? additionalReferences = null) { - string temp = Path.GetTempFileName() + ".fbs"; + string tempDirectory = Path.Combine(Path.GetPathRoot(RootDirectory)!, "flatsharptemp", Guid.NewGuid().ToString("n")); + Directory.CreateDirectory(tempDirectory); + + string temp = Path.Combine(tempDirectory, "schema.fbs"); File.WriteAllText(temp, fbsSchema); try @@ -278,6 +283,7 @@ internal static (Assembly, string) CompileAndLoadAssemblyWithCode( finally { File.Delete(temp); + Directory.Delete(tempDirectory, true); } } @@ -349,7 +355,7 @@ private static (Assembly, string) CompileAndLoadAssemblyWithCode( options.InputFiles = fbsFiles.Select(x => x.FullName); - List bfbs = GetBfbs(options); + List<(byte[], string)> bfbs = GetBfbs(options); string cSharp = CreateCSharp(bfbs, "hash", options); var (assembly, formattedText, _) = RoslynSerializerGenerator.CompileAssembly(cSharp, true, additionalRefs); @@ -362,7 +368,7 @@ private static (Assembly, string) CompileAndLoadAssemblyWithCode( } } - private static List GetBfbs(CompilerOptions options) + private static List<(byte[] bfbs, string fbsPath)> GetBfbs(CompilerOptions options) { string flatcPath; @@ -378,107 +384,107 @@ private static List GetBfbs(CompilerOptions options) flatcPath = options.FlatcPath; } + List<(byte[] bfbs, string fbsPath)> results = new(); string temp = Path.GetTempPath(); string dirName = $"flatsharpcompiler_temp_{Guid.NewGuid():n}"; string outputDir = Path.Combine(temp, dirName); - Directory.CreateDirectory(outputDir); - using var p = new Process + try { - StartInfo = new ProcessStartInfo + foreach (var inputFile in options.InputFiles) { - CreateNoWindow = true, - RedirectStandardError = true, - RedirectStandardOutput = true, - UseShellExecute = false, - FileName = flatcPath, - } - }; + string inputFullPath = PathHelpers.NormalizePathName(inputFile); - var args = new List - { - "-b", - "--schema", - "--bfbs-comments", - "--bfbs-builtins", - "--bfbs-filenames", - Path.GetDirectoryName(typeof(ISchemaMutator).Assembly.Location!)!, - "--no-warnings", - "-o", - outputDir, - }; + using var p = new Process + { + StartInfo = new ProcessStartInfo + { + CreateNoWindow = true, + RedirectStandardError = true, + RedirectStandardOutput = true, + UseShellExecute = false, + FileName = flatcPath, + } + }; - if (!string.IsNullOrEmpty(options.IncludesDirectory)) - { - // One or more includes directory has been specified - foreach (var includePath in options.IncludesDirectory.Split(';', StringSplitOptions.RemoveEmptyEntries)) - { - args.AddRange(new[] + var args = new List { - "-I", - new DirectoryInfo(includePath).FullName, - }); - } - } + "-b", + "--schema", + "--bfbs-comments", + "--bfbs-builtins", + "--bfbs-filenames", + RootDirectory, + "--no-warnings", + "-o", + outputDir, + }; + + if (!string.IsNullOrEmpty(options.IncludesDirectory)) + { + // One or more includes directory has been specified + foreach (var includePath in options.IncludesDirectory.Split(';', StringSplitOptions.RemoveEmptyEntries)) + { + args.AddRange(new[] + { + "-I", + new DirectoryInfo(includePath).FullName, + }); + } + } - foreach (var item in options.InputFiles) - { - args.Add(new FileInfo(item).FullName); - } + foreach (var arg in args) + { + p.StartInfo.ArgumentList.Add(arg); + } - foreach (var arg in args) - { - p.StartInfo.ArgumentList.Add(arg); - } + p.StartInfo.ArgumentList.Add(inputFullPath); - try - { - p.EnableRaisingEvents = true; + p.EnableRaisingEvents = true; - var lines = new List(); + var lines = new List(); - void OnDataReceived(object sender, DataReceivedEventArgs args) - { - if (!string.IsNullOrEmpty(args.Data)) + void OnDataReceived(object sender, DataReceivedEventArgs args) { - lines.Add(args.Data); + if (!string.IsNullOrEmpty(args.Data)) + { + lines.Add(args.Data); + } } - } - p.OutputDataReceived += OnDataReceived; - p.ErrorDataReceived += OnDataReceived; + p.OutputDataReceived += OnDataReceived; + p.ErrorDataReceived += OnDataReceived; - p.Start(); - p.BeginOutputReadLine(); - p.BeginErrorReadLine(); - p.WaitForExit(); + p.Start(); + p.BeginOutputReadLine(); + p.BeginErrorReadLine(); + p.WaitForExit(); - if (p.ExitCode == 0) - { - List bfbs = new(); - foreach (string output in Directory.GetFiles(outputDir, "*.bfbs")) + if (p.ExitCode == 0) { - bfbs.Add(File.ReadAllBytes(output)); + results.Add(( + File.ReadAllBytes(Path.Combine(outputDir, Path.GetFileNameWithoutExtension(inputFullPath) + ".bfbs")), + inputFullPath)); } - - return bfbs; - } - else - { - foreach (var line in lines) + else { - ErrorContext.Current.RegisterError(line); - } + foreach (var line in lines) + { + ErrorContext.Current.RegisterError(line); + } - ErrorContext.Current.ThrowIfHasErrors(); - throw new InvalidFbsFileException("Unknown error when invoking flatc. Process exited with error, but didn't write any errors."); + ErrorContext.Current.ThrowIfHasErrors(); + throw new InvalidFbsFileException("Unknown error when invoking flatc. Process exited with error, but didn't write any errors."); + } } } finally { Directory.Delete(outputDir, recursive: true); } + + return results; } [ExcludeFromCodeCoverage] @@ -519,7 +525,7 @@ private static (string os, string name) GetFlatcPath() } private static string CreateCSharp( - List bfbs, + List<(byte[] bfbs, string inputPath)> bfbs, string inputHash, CompilerOptions options) { @@ -548,14 +554,15 @@ private static string CreateCSharp( { new FieldNameNormalizerSchemaMutator(), new ExternalTypeSchemaMutator(), + new AbsolutePathSchemaMutator(RootDirectory), }; Stopwatch sw = Stopwatch.StartNew(); ISerializer mutableSerializer = Instrument("CompileReflectionFbs", options, FlatBufferSerializer.Default.Compile); - foreach (var s in bfbs) + foreach ((byte[] s, string fbsPath) in bfbs) { - rootModel.UnionWith(ParseSchema(mutableSerializer, s, options, postProcessTransforms, mutators).ToRootModel(options)); + rootModel.UnionWith(ParseSchema(mutableSerializer, s, options, postProcessTransforms, mutators).ToRootModel(options, fbsPath)); } ErrorContext.Current.ThrowIfHasErrors(); @@ -666,10 +673,16 @@ private static T Instrument(string step, CompilerOptions opts, Func callba private static Assembly[] BuildAdditionalReferences(CompilerOptions options, IEnumerable? additionalReferences = null) { var references = new List(); + if (additionalReferences is not null) + { references.AddRange(additionalReferences); + } + if (options.UnityAssemblyPath is not null) + { references.Add(Assembly.LoadFrom(options.UnityAssemblyPath)); + } return references.ToArray(); } diff --git a/src/FlatSharp.Compiler/PathHelpers.cs b/src/FlatSharp.Compiler/PathHelpers.cs new file mode 100644 index 00000000..05324468 --- /dev/null +++ b/src/FlatSharp.Compiler/PathHelpers.cs @@ -0,0 +1,39 @@ +/* + * Copyright 2023 James Courtney + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.IO; +using System.Runtime.InteropServices; + +namespace FlatSharp.Compiler; + +public static class PathHelpers +{ + public static string NormalizePathName(string path) + { + FileInfo info = new FileInfo(path); + FlatSharpInternal.Assert(info.Exists, "expect path to exist: " + path); + + path = info.FullName; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // case-insensitive! + path = path.ToLowerInvariant(); + } + + return path; + } +} \ No newline at end of file diff --git a/src/FlatSharp.Compiler/Schema/Schema.cs b/src/FlatSharp.Compiler/Schema/Schema.cs index a58d5111..0d2415f5 100644 --- a/src/FlatSharp.Compiler/Schema/Schema.cs +++ b/src/FlatSharp.Compiler/Schema/Schema.cs @@ -60,12 +60,12 @@ public class Schema [FlatBufferItem(6)] public virtual AdvancedFeatures AdvancedFeatures { get; set; } - [FlatBufferItem(7)] - public virtual IIndexedVector? FbsFiles { get; set; } + [FlatBufferItem(7, Required = true)] + public virtual IIndexedVector FbsFiles { get; set; } = new IndexedVector(); - public RootModel ToRootModel(CompilerOptions options) + public RootModel ToRootModel(CompilerOptions options, string fbsPath) { - RootModel model = new RootModel(this.AdvancedFeatures); + RootModel model = new RootModel(this.AdvancedFeatures, fbsPath); foreach (var @enum in this.Enums) { diff --git a/src/FlatSharp.Compiler/SchemaModel/BaseReferenceTypeSchemaModel.cs b/src/FlatSharp.Compiler/SchemaModel/BaseReferenceTypeSchemaModel.cs index a9b642b2..b0b6e24f 100644 --- a/src/FlatSharp.Compiler/SchemaModel/BaseReferenceTypeSchemaModel.cs +++ b/src/FlatSharp.Compiler/SchemaModel/BaseReferenceTypeSchemaModel.cs @@ -179,7 +179,7 @@ private void EmitDeserializationConstructor(CodeWriter writer) private void EmitPoolableObject(CodeWriter writer, CompileContext context) { - if (context.Options.GeneratePoolableObjects == true) + if (context.Options.GeneratePoolableObjects) { writer.AppendLine("/// "); writer.AppendLine("public virtual void ReturnToPool(bool unsafeForce = false)"); diff --git a/src/FlatSharp.Compiler/SchemaModel/ReferenceStructSchemaModel.cs b/src/FlatSharp.Compiler/SchemaModel/ReferenceStructSchemaModel.cs index 9c8fdce5..a076940b 100644 --- a/src/FlatSharp.Compiler/SchemaModel/ReferenceStructSchemaModel.cs +++ b/src/FlatSharp.Compiler/SchemaModel/ReferenceStructSchemaModel.cs @@ -78,7 +78,7 @@ protected override void EmitClassDefinition(CodeWriter writer, CompileContext co writer.AppendLine($"public partial class {this.Name}"); writer.AppendLine($" : object"); - if (context.Options.GeneratePoolableObjects == true) + if (context.Options.GeneratePoolableObjects) { writer.AppendLine($" , IPoolableObject"); } diff --git a/src/FlatSharp.Compiler/SchemaModel/RootModel.cs b/src/FlatSharp.Compiler/SchemaModel/RootModel.cs index 4243124a..bac297b4 100644 --- a/src/FlatSharp.Compiler/SchemaModel/RootModel.cs +++ b/src/FlatSharp.Compiler/SchemaModel/RootModel.cs @@ -16,6 +16,8 @@ using FlatSharp.CodeGen; using FlatSharp.Compiler.Schema; +using Microsoft.CodeAnalysis.FlowAnalysis; +using System.Linq; namespace FlatSharp.Compiler.SchemaModel; @@ -28,13 +30,20 @@ public class RootModel private readonly Dictionary elements = new(); - public RootModel(AdvancedFeatures advancedFeatures) + private readonly HashSet inputFiles = new(); + + public RootModel(AdvancedFeatures advancedFeatures, string? inputFile = null) { if ((advancedFeatures & ~SupportedAdvancedFeatures) != AdvancedFeatures.None) { // bail immediately. We can't make any progress. throw new InvalidFbsFileException($"FBS schema contains advanced features that FlatSharp does not yet support."); } + + if (inputFile is not null) + { + this.inputFiles.Add(inputFile); + } } public void UnionWith(RootModel other) @@ -54,6 +63,8 @@ public void UnionWith(RootModel other) this.elements[kvp.Key] = kvp.Value; } } + + this.inputFiles.UnionWith(other.inputFiles); } public void AddElement(BaseSchemaModel model) @@ -118,6 +129,7 @@ internal void WriteCode(CodeWriter writer, CompileContext context) writer.AppendLine("#nullable enable annotations"); } + if (context.CompilePass > CodeWritingPass.PropertyModeling && context.PreviousAssembly is not null) { context.FullyQualifiedCloneMethodName = CloneMethodsGenerator.GenerateCloneMethodsForAssembly( @@ -126,21 +138,32 @@ internal void WriteCode(CodeWriter writer, CompileContext context) context.PreviousAssembly, context.TypeModelContainer); - HashSet seenTypes = new(); - foreach (var item in this.elements.Values) + if (!context.Options.ClassDefinitionsOnly) { - item.TraverseTypeModel(context, seenTypes); - } + HashSet seenTypes = new(); - foreach (Type t in seenTypes) - { - WriteHelperClass(t, context, writer); + foreach (var item in this.elements.Values) + { + item.TraverseTypeModel(context, seenTypes); + } + + foreach (Type t in seenTypes) + { + WriteHelperClass(t, context, writer); + } } } foreach (var item in this.elements.Values) { - item.WriteCode(writer, context); + bool emit = context.Options.SpecifiedFilesOnly == false + || this.inputFiles.Contains(item.DeclaringFile) + || context.CompilePass < CodeWritingPass.LastPass; + + if (emit) + { + item.WriteCode(writer, context); + } } } diff --git a/src/FlatSharp.Compiler/SchemaModel/TableSchemaModel.cs b/src/FlatSharp.Compiler/SchemaModel/TableSchemaModel.cs index 564488aa..b20f3a89 100644 --- a/src/FlatSharp.Compiler/SchemaModel/TableSchemaModel.cs +++ b/src/FlatSharp.Compiler/SchemaModel/TableSchemaModel.cs @@ -102,7 +102,7 @@ protected override void EmitClassDefinition(CodeWriter writer, CompileContext co { writer.AppendLine(": object"); - if (context.Options.GeneratePoolableObjects == true) + if (context.Options.GeneratePoolableObjects) { writer.AppendLine(", IPoolableObject"); } diff --git a/src/FlatSharp.Compiler/SchemaModel/ValueUnionSchemaModel.cs b/src/FlatSharp.Compiler/SchemaModel/ValueUnionSchemaModel.cs index 207a3803..ebdb5db3 100644 --- a/src/FlatSharp.Compiler/SchemaModel/ValueUnionSchemaModel.cs +++ b/src/FlatSharp.Compiler/SchemaModel/ValueUnionSchemaModel.cs @@ -49,7 +49,7 @@ public static bool TryCreate( return false; } - if (context.GeneratePoolableObjects == true) + if (context.GeneratePoolableObjects) { model = new ReferenceUnionSchemaModel(schema, union); } diff --git a/src/FlatSharp.Compiler/SchemaMutators/AbsolutePathSchemaMutator.cs b/src/FlatSharp.Compiler/SchemaMutators/AbsolutePathSchemaMutator.cs new file mode 100644 index 00000000..97689bf5 --- /dev/null +++ b/src/FlatSharp.Compiler/SchemaMutators/AbsolutePathSchemaMutator.cs @@ -0,0 +1,88 @@ +/* + * Copyright 2022 James Courtney + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using FlatSharp.Compiler; +using FlatSharp.Compiler.Schema; +using FlatSharp.Compiler.SchemaModel; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + +/// +/// +internal class AbsolutePathSchemaMutator : ISchemaMutator +{ + private readonly string rootDirectory; + + public AbsolutePathSchemaMutator(string rootDirectory) + { + this.rootDirectory = rootDirectory; + } + + public void Mutate( + Schema schema, + CompilerOptions options, + List> postProcessors) + { + foreach (var fbsFile in schema.FbsFiles.Select(x => x.Value)) + { + fbsFile.FileName = this.NormalizePath(fbsFile.FileName); + } + + foreach (var @object in schema.Objects) + { + @object.DeclarationFile = this.NormalizePath(@object.DeclarationFile); + } + + foreach (var @enum in schema.Enums) + { + @enum.DeclarationFile = this.NormalizePath(@enum.DeclarationFile); + } + + if (schema.Services is not null) + { + foreach (var service in schema.Services) + { + service.DeclaringFile = this.NormalizePath(service.DeclaringFile); + } + } + + if (schema.RootTable is not null) + { + schema.RootTable.DeclarationFile = this.NormalizePath(schema.RootTable.DeclarationFile); + } + } + + private string NormalizePath(string fbsPath) + { + string[] parts = fbsPath.Split('/', StringSplitOptions.RemoveEmptyEntries); + string path = this.rootDirectory; + + foreach (string part in parts) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && part == ":") + { + // flatc bug that seems to include the ':' as part of a windows path. + continue; + } + + path = Path.Combine(path, part); + } + + return PathHelpers.NormalizePathName(path); + } +} \ No newline at end of file diff --git a/src/FlatSharp.Compiler/SchemaMutators/ExternalTypeSchemaMutator.cs b/src/FlatSharp.Compiler/SchemaMutators/ExternalTypeSchemaMutator.cs index 4a2613a0..a0a546fa 100644 --- a/src/FlatSharp.Compiler/SchemaMutators/ExternalTypeSchemaMutator.cs +++ b/src/FlatSharp.Compiler/SchemaMutators/ExternalTypeSchemaMutator.cs @@ -23,7 +23,7 @@ /// Renames external types to have unique, random names, then replaces those in the output with real names. /// /// -/// This class is slightly. The idea for external types is that they are defined in assemblies that FlatSharp doesn't know about. +/// This class is slightly odd. The idea for external types is that they are defined in assemblies that FlatSharp doesn't know about. /// However, the FlatSharp type model needs full knowledge of these types in order to build serializers. So, we emit "temporary" types /// to take the place of these external types while we build our serializer. Then, at the end, we do a big find/replace to swap /// the temporary types for the real types. diff --git a/src/FlatSharp/FlatBufferVectorHelpers_Greedy.cs b/src/FlatSharp/FlatBufferVectorHelpers_Greedy.cs index b57ba7ec..8e831149 100644 --- a/src/FlatSharp/FlatBufferVectorHelpers_Greedy.cs +++ b/src/FlatSharp/FlatBufferVectorHelpers_Greedy.cs @@ -35,6 +35,7 @@ public static (string classDef, string className) CreateGreedyVector( string classDef = $$"""" + [System.Diagnostics.DebuggerDisplay("Greedy [ {{itemTypeModel.ClrType.Name}} ], Count = {Count}")] internal sealed class {{className}} : object , IList<{{baseTypeName}}> diff --git a/src/FlatSharp/FlatBufferVectorHelpers_GreedyMutable.cs b/src/FlatSharp/FlatBufferVectorHelpers_GreedyMutable.cs index 0b7482d3..40a3f751 100644 --- a/src/FlatSharp/FlatBufferVectorHelpers_GreedyMutable.cs +++ b/src/FlatSharp/FlatBufferVectorHelpers_GreedyMutable.cs @@ -50,6 +50,7 @@ string IfMutable(string str) string classDef = $$"""" + [System.Diagnostics.DebuggerDisplay("GreedyMutable [ {{itemTypeModel.ClrType.Name}} ], Count = {Count}")] internal sealed class {{className}} : object , IList<{{baseTypeName}}> diff --git a/src/FlatSharp/FlatBufferVectorHelpers_GreedyMutableUnion.cs b/src/FlatSharp/FlatBufferVectorHelpers_GreedyMutableUnion.cs index ee493c06..fd296788 100644 --- a/src/FlatSharp/FlatBufferVectorHelpers_GreedyMutableUnion.cs +++ b/src/FlatSharp/FlatBufferVectorHelpers_GreedyMutableUnion.cs @@ -33,6 +33,7 @@ public static (string classDef, string className) CreateGreedyMutableUnionVector string classDef = $$"""" + [System.Diagnostics.DebuggerDisplay("GreedyMutable [ {{itemTypeModel.ClrType.Name}} ], Count = {Count}")] internal sealed class {{className}} : object , IList<{{baseTypeName}}> diff --git a/src/FlatSharp/FlatBufferVectorHelpers_GreedyUnion.cs b/src/FlatSharp/FlatBufferVectorHelpers_GreedyUnion.cs index 78eff0c4..df3cb2ce 100644 --- a/src/FlatSharp/FlatBufferVectorHelpers_GreedyUnion.cs +++ b/src/FlatSharp/FlatBufferVectorHelpers_GreedyUnion.cs @@ -35,6 +35,7 @@ public static (string classDef, string className) CreateGreedyUnionVector( string classDef = $$"""" + [System.Diagnostics.DebuggerDisplay("Greedy [ {{itemTypeModel.ClrType.Name}} ], Count = {Count}")] internal sealed class {{className}} : object , IList<{{baseTypeName}}> diff --git a/src/FlatSharp/FlatBufferVectorHelpers_Lazy.cs b/src/FlatSharp/FlatBufferVectorHelpers_Lazy.cs index b2d6090f..32452829 100644 --- a/src/FlatSharp/FlatBufferVectorHelpers_Lazy.cs +++ b/src/FlatSharp/FlatBufferVectorHelpers_Lazy.cs @@ -36,6 +36,7 @@ public static (string classDef, string className) CreateLazyVector( string classDef = $$"""" + [System.Diagnostics.DebuggerDisplay("Lazy [ {{itemTypeModel.ClrType.Name}} ], Count = {Count}")] internal sealed class {{className}} : object , IList<{{baseTypeName}}> diff --git a/src/FlatSharp/FlatBufferVectorHelpers_LazyUnion.cs b/src/FlatSharp/FlatBufferVectorHelpers_LazyUnion.cs index 64516528..53bb8382 100644 --- a/src/FlatSharp/FlatBufferVectorHelpers_LazyUnion.cs +++ b/src/FlatSharp/FlatBufferVectorHelpers_LazyUnion.cs @@ -36,6 +36,7 @@ public static (string classDef, string className) CreateLazyUnionVector( string classDef = $$"""" + [System.Diagnostics.DebuggerDisplay("Lazy [ {{itemTypeModel.ClrType.Name}} ], Count = {Count}")] internal sealed class {{className}} : object , IList<{{baseTypeName}}> diff --git a/src/FlatSharp/FlatBufferVectorHelpers_Progressive.cs b/src/FlatSharp/FlatBufferVectorHelpers_Progressive.cs index 0c1cb7c0..dffda683 100644 --- a/src/FlatSharp/FlatBufferVectorHelpers_Progressive.cs +++ b/src/FlatSharp/FlatBufferVectorHelpers_Progressive.cs @@ -38,6 +38,7 @@ public static (string classDef, string className) CreateProgressiveVector( string classDef = $$"""" + [System.Diagnostics.DebuggerDisplay("Progressive [ {{itemTypeModel.ClrType.Name}} ], Count = {Count}")] internal sealed class {{className}} : object , IList<{{baseTypeName}}> diff --git a/src/FlatSharp/FlatBufferVectorHelpers_ProgressiveUnion.cs b/src/FlatSharp/FlatBufferVectorHelpers_ProgressiveUnion.cs index 639a0c1e..d5a68b5f 100644 --- a/src/FlatSharp/FlatBufferVectorHelpers_ProgressiveUnion.cs +++ b/src/FlatSharp/FlatBufferVectorHelpers_ProgressiveUnion.cs @@ -35,6 +35,7 @@ public static (string classDef, string className) CreateProgressiveUnionVector( string classDef = $$"""" + [System.Diagnostics.DebuggerDisplay("Progressive [ {{itemTypeModel.ClrType.Name}} ], Count = {Count}")] internal sealed class {{className}} : object , IList<{{baseTypeName}}> diff --git a/src/FlatSharp/Serialization/DeserializeClassDefinition.cs b/src/FlatSharp/Serialization/DeserializeClassDefinition.cs index a456ac68..0cb6a429 100644 --- a/src/FlatSharp/Serialization/DeserializeClassDefinition.cs +++ b/src/FlatSharp/Serialization/DeserializeClassDefinition.cs @@ -284,6 +284,7 @@ public override string ToString() return $@" + [System.Diagnostics.DebuggerDisplay(""{this.options.DeserializationOption} {this.typeModel.ClrType.Name}"")] internal sealed class {this.ClassName} : {typeModel.GetGlobalCompilableTypeName()} , {interfaceGlobalName}