Fixed a stackoverflow bug when generating a Rest Client and the object has it's type as a sub type. Bumped package versino to 1.7.5

This commit is contained in:
2023-12-14 11:14:27 -08:00
parent 9633e211a1
commit 38ef135b8a
3 changed files with 20 additions and 8 deletions

View File

@@ -17,7 +17,7 @@
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Version>1.7.4</Version>
<Version>1.7.5</Version>
<PackageReleaseNotes></PackageReleaseNotes>
<PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
</PropertyGroup>

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.Design;
@@ -69,11 +69,14 @@ namespace MontoyaTech.Rest.Net
{
foreach (var argument in arguments)
{
var types = this.FindTypeDependencies(argument);
if (argument != type)
{
var types = this.FindTypeDependencies(argument);
for (int i = 0; i < types.Count; i++)
if (!dependencies.Contains(types[i]))
dependencies.Add(types[i]);
for (int i = 0; i < types.Count; i++)
if (!dependencies.Contains(types[i]))
dependencies.Add(types[i]);
}
}
}
@@ -99,7 +102,7 @@ namespace MontoyaTech.Rest.Net
{
foreach (var field in fields)
{
if (field.IsPublic && !field.IsSpecialName)
if (field.IsPublic && !field.IsSpecialName && field.FieldType != type)
{
var types = this.FindTypeDependencies(field.FieldType);
@@ -116,7 +119,7 @@ namespace MontoyaTech.Rest.Net
{
foreach (var property in properties)
{
if (!property.IsSpecialName && property.GetSetMethod() != null && property.GetGetMethod() != null)
if (!property.IsSpecialName && property.GetSetMethod() != null && property.GetGetMethod() != null && property.PropertyType != type)
{
var types = this.FindTypeDependencies(property.PropertyType);