Skip to content

Commit

Permalink
Regression: fix decimal type dumping. (#45)
Browse files Browse the repository at this point in the history
Co-authored-by: yevhen.cherkes <[email protected]>
  • Loading branch information
ycherkes and yevhen.cherkes authored Jun 3, 2024
1 parent c9fa09a commit 7263c8e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Developed as a free alternative to [ObjectDumper.NET](https://github.com/thomasg

Actively used as a part of [Object Dumper Visual Studio and Visual Studio Code extension](https://github.com/ycherkes/ObjectDumper)

[![nuget version](https://img.shields.io/badge/Nuget-v1.0.4.10-blue)](https://www.nuget.org/packages/VarDump)
[![nuget version](https://img.shields.io/badge/Nuget-v1.0.4.11-blue)](https://www.nuget.org/packages/VarDump)
[![nuget downloads](https://img.shields.io/nuget/dt/VarDump?label=Downloads)](https://www.nuget.org/packages/VarDump)

### C# & VB Dumper:
Expand Down
8 changes: 4 additions & 4 deletions src/VarDump.Extensions/VarDump.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<AssemblyName>VarDump.Extensions</AssemblyName>
<AssemblyVersion>1.0.4.10</AssemblyVersion>
<FileVersion>1.0.4.10</FileVersion>
<AssemblyVersion>1.0.4.11</AssemblyVersion>
<FileVersion>1.0.4.11</FileVersion>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Copyright>Copyright $([System.DateTime]::Now.Year) Yevhen Cherkes</Copyright>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>VarDump.Extensions</Title>
<Version>1.0.4.10</Version>
<Version>1.0.4.11</Version>
<Description>Extension methods for simplifying the usage of the VarDump library.</Description>
<PackageProjectUrl>https://github.com/ycherkes/VarDump</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand All @@ -36,7 +36,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="VarDump" Version="1.0.4.10" />
<PackageReference Include="VarDump" Version="1.0.4.11" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions src/VarDump/Utils/ReflectionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ public static bool IsPrimitive(Type type)
private static bool IsPrimitiveInternal(Type type)
{
return type == typeof(string)
|| type == typeof(decimal)
|| type.IsPrimitive
&& type != typeof(IntPtr)
&& type != typeof(UIntPtr);
Expand Down
6 changes: 3 additions & 3 deletions src/VarDump/VarDump.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<AssemblyName>VarDump</AssemblyName>
<AssemblyVersion>1.0.4.10</AssemblyVersion>
<FileVersion>1.0.4.10</FileVersion>
<AssemblyVersion>1.0.4.11</AssemblyVersion>
<FileVersion>1.0.4.11</FileVersion>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Copyright>Copyright 2023 - $([System.DateTime]::Now.Year) Yevhen Cherkes</Copyright>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>VarDump</Title>
<Version>1.0.4.10</Version>
<Version>1.0.4.11</Version>
<Description>VarDump is a utility for serialization runtime objects to C# and Visual Basic string.</Description>
<PackageProjectUrl>https://github.com/ycherkes/VarDump</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
31 changes: 31 additions & 0 deletions test/VarDump.UnitTests/PrimitiveTypesSpec.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Xunit;

namespace VarDump.UnitTests
{
public class PrimitiveTypesSpec
{
[Fact]
public void DumpDecimalCSharp()
{
const decimal value = 0.00000M;

var dumper = new CSharpDumper();

var result = dumper.Dump(value);

Assert.Equal("var decimalValue = 0.00000m;\r\n", result);
}

[Fact]
public void DumpDecimalVb()
{
const decimal value = 0.00000M;

var dumper = new VisualBasicDumper();

var result = dumper.Dump(value);

Assert.Equal("Dim decimalValue = 0.00000D\r\n", result);
}
}
}

0 comments on commit 7263c8e

Please sign in to comment.