Skip to content

Commit c7bd18e

Browse files
authored
Merge pull request #497 from Inxton/496-bug-componentgetattributename-return-null
[BUG] Component.GetAttributeName return null
2 parents 42e0857 + 03c7be7 commit c7bd18e

74 files changed

Lines changed: 719 additions & 7 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<!-- Framework-Agnostic Packages -->
1717
<ItemGroup>
18-
<PackageVersion Include="Inxton.Operon" Version="0.3.0-alpha.107" />
18+
<PackageVersion Include="Inxton.Operon" Version="0.3.0-alpha.108" />
1919
<PackageVersion Include="Cake.DocFx" Version="1.0.0" />
2020
<PackageVersion Include="Octokit" Version="13.0.1" />
2121
<PackageVersion Include="Octokit.Extensions" Version="1.0.7" />

src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ private void CreateITwinObjectImplementation()
435435
"public string Symbol { get; protected set; }" +
436436
"private string _attributeName;" +
437437
"public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; }" +
438-
"public System.String GetAttributeName(System.Globalization.CultureInfo culture) { return this.Translate(_attributeName, culture).Interpolate(this); }" +
438+
"public System.String GetAttributeName(System.Globalization.CultureInfo culture) { if (string.IsNullOrEmpty(_attributeName)) { return SymbolTail; } return this.Translate(_attributeName, culture).Interpolate(this); }" +
439439
"private string _humanReadable;" +
440440
"public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; }" +
441441
"public System.String GetHumanReadable(System.Globalization.CultureInfo culture) { return this.Translate(_humanReadable, culture); }" +

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ private void CompareOutputs(string memberName)
327327

328328
var actualFileContentLines = actualFileContent.Split("\n").Select(a => a.Trim()).ToArray();
329329
var expectedFileContentLines = expectedFileContent.Split("\n").Select(a => a.Trim()).ToArray();
330-
330+
output.WriteLine($"Actual output file: {actualSourceFile}");
331+
output.WriteLine($"Expected output file: {expectedSourceFile}");
331332
for (int i = 0; i < expectedFileContentLines.Length; i++)
332333
{
333334
Assert.Equal(expectedFileContentLines[i], actualFileContentLines[i]);

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Integration.Cs/IxProjectTests.IntegrationCs.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ public void should_match_expected_and_generated_whole_project()
173173
}
174174
catch (Exception)
175175
{
176+
177+
output.WriteLine("--------------------------------------------------");
178+
output.WriteLine($"Actual file: {actualList[currentIndex]}");
179+
output.WriteLine($"Expected file: {exp}");
180+
output.WriteLine("--------------------------------------------------");
181+
176182
output.WriteLine($"-- Case: {new FileInfo(exp).Name} vs {new FileInfo(actualList[currentIndex]).Name}");
177183
output.WriteLine($"-- expected\n{expectedFileContent}");
178184
output.WriteLine($"-- actual\n{actualFileContent}");
@@ -216,10 +222,15 @@ public void should_generate_all_even_when_fails_somewhere()
216222
var actualFileContent = File.ReadAllText(actualList[currentIndex]);
217223
try
218224
{
225+
219226
Assert.Equal(expectedFileContent, actualFileContent);
220227
}
221228
catch (Exception)
222229
{
230+
output.WriteLine("--------------------------------------------------");
231+
output.WriteLine($"Actual file: {actualList[currentIndex]}");
232+
output.WriteLine($"Expected file: {exp}");
233+
output.WriteLine("--------------------------------------------------");
223234
output.WriteLine($"-- Case: {new FileInfo(exp).Name} vs {new FileInfo(actualList[currentIndex]).Name}");
224235
output.WriteLine($"-- expected\n{expectedFileContent}");
225236
output.WriteLine($"-- actual\n{actualFileContent}");

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/abstract_members.g.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ public AXSharp.Connector.ITwinObject GetParent()
216216

217217
public System.String GetAttributeName(System.Globalization.CultureInfo culture)
218218
{
219+
if (string.IsNullOrEmpty(_attributeName))
220+
{
221+
return SymbolTail;
222+
}
223+
219224
return this.Translate(_attributeName, culture).Interpolate(this);
220225
}
221226

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/array_declaration.g.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ public AXSharp.Connector.ITwinObject GetParent()
240240

241241
public System.String GetAttributeName(System.Globalization.CultureInfo culture)
242242
{
243+
if (string.IsNullOrEmpty(_attributeName))
244+
{
245+
return SymbolTail;
246+
}
247+
243248
return this.Translate(_attributeName, culture).Interpolate(this);
244249
}
245250

@@ -434,6 +439,11 @@ public AXSharp.Connector.ITwinObject GetParent()
434439

435440
public System.String GetAttributeName(System.Globalization.CultureInfo culture)
436441
{
442+
if (string.IsNullOrEmpty(_attributeName))
443+
{
444+
return SymbolTail;
445+
}
446+
437447
return this.Translate(_attributeName, culture).Interpolate(this);
438448
}
439449

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,11 @@ public AXSharp.Connector.ITwinObject GetParent()
536536

537537
public System.String GetAttributeName(System.Globalization.CultureInfo culture)
538538
{
539+
if (string.IsNullOrEmpty(_attributeName))
540+
{
541+
return SymbolTail;
542+
}
543+
539544
return this.Translate(_attributeName, culture).Interpolate(this);
540545
}
541546

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,11 @@ public AXSharp.Connector.ITwinObject GetParent()
350350

351351
public System.String GetAttributeName(System.Globalization.CultureInfo culture)
352352
{
353+
if (string.IsNullOrEmpty(_attributeName))
354+
{
355+
return SymbolTail;
356+
}
357+
353358
return this.Translate(_attributeName, culture).Interpolate(this);
354359
}
355360

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends.g.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ public AXSharp.Connector.ITwinObject GetParent()
312312

313313
public System.String GetAttributeName(System.Globalization.CultureInfo culture)
314314
{
315+
if (string.IsNullOrEmpty(_attributeName))
316+
{
317+
return SymbolTail;
318+
}
319+
315320
return this.Translate(_attributeName, culture).Interpolate(this);
316321
}
317322

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends_and_implements.g.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ public AXSharp.Connector.ITwinObject GetParent()
312312

313313
public System.String GetAttributeName(System.Globalization.CultureInfo culture)
314314
{
315+
if (string.IsNullOrEmpty(_attributeName))
316+
{
317+
return SymbolTail;
318+
}
319+
315320
return this.Translate(_attributeName, culture).Interpolate(this);
316321
}
317322

0 commit comments

Comments
 (0)