Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case for #1196 #1197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions Fody.sln
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cecil", "cecil", "{FE2F1D5B
cecil\Directory.Build.props = cecil\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdbIssueWithFody", "PdbTests\PdbIssueWithFody\PdbIssueWithFody.csproj", "{4EDAB3D8-F038-4C6C-A4E9-8B4268AF0208}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdbIssueWithoutFody", "PdbTests\PdbIssueWithoutFody\PdbIssueWithoutFody.csproj", "{36BCBD3C-86C1-487F-AB2C-023C90A833CE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdbTest", "PdbTest\PdbTest.csproj", "{F7D0C3DD-C3DB-4AEA-B8E7-E8E185D56EAF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -117,6 +123,18 @@ Global
{70E05599-64EE-4C11-A2F8-EE4113309039}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70E05599-64EE-4C11-A2F8-EE4113309039}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70E05599-64EE-4C11-A2F8-EE4113309039}.Release|Any CPU.Build.0 = Release|Any CPU
{4EDAB3D8-F038-4C6C-A4E9-8B4268AF0208}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EDAB3D8-F038-4C6C-A4E9-8B4268AF0208}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EDAB3D8-F038-4C6C-A4E9-8B4268AF0208}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EDAB3D8-F038-4C6C-A4E9-8B4268AF0208}.Release|Any CPU.Build.0 = Release|Any CPU
{36BCBD3C-86C1-487F-AB2C-023C90A833CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36BCBD3C-86C1-487F-AB2C-023C90A833CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36BCBD3C-86C1-487F-AB2C-023C90A833CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36BCBD3C-86C1-487F-AB2C-023C90A833CE}.Release|Any CPU.Build.0 = Release|Any CPU
{F7D0C3DD-C3DB-4AEA-B8E7-E8E185D56EAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F7D0C3DD-C3DB-4AEA-B8E7-E8E185D56EAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F7D0C3DD-C3DB-4AEA-B8E7-E8E185D56EAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F7D0C3DD-C3DB-4AEA-B8E7-E8E185D56EAF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
39 changes: 39 additions & 0 deletions PdbTest/Pdb/PdbTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using Xunit;

public class PdbTests
{
[Fact]
public void ShouldContainNewFilePathWithFody()
{
var assembly = typeof(PdbIssueWithFody.Program).Assembly;
var hasPath = Test(assembly);

Assert.True(hasPath);
}

[Fact]
public void ShouldContainNewFilePathWithoutFody()
{
var assembly = typeof(PdbIssueWithoutFody.Program).Assembly;
var hasPath = Test(assembly);

Assert.True(hasPath);
}

public static bool Test(Assembly assembly)
{
var myassembly = assembly.Location ?? "";
var mypdb = myassembly.Replace(".dll", ".pdb");

var pdbtext = File.ReadAllText(myassembly);

var containsnewpath = pdbtext.Contains("MyNewPath");

return containsnewpath;
}
}
27 changes: 27 additions & 0 deletions PdbTest/PdbTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\PdbTests\PdbIssueWithFody\PdbIssueWithFody.csproj" />
<ProjectReference Include="..\PdbTests\PdbIssueWithoutFody\PdbIssueWithoutFody.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Nullable" Version="1.3.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="[17.1.0]" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Verify.Xunit" Version="20.6.0" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup Condition="$(TargetFrameworkIdentifier) == '.NETFramework'">
<Reference Include="Microsoft.Build.Utilities.v4.0" Aliases="msbuild4" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions PdbTests/PdbIssueWithFody/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
74 changes: 74 additions & 0 deletions PdbTests/PdbIssueWithFody/FodyWeavers.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="TriggerDependentProperties" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the Dependent properties feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EnableIsChangedProperty" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the IsChanged property feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressWarnings" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
14 changes: 14 additions & 0 deletions PdbTests/PdbIssueWithFody/PdbIssueWithFody.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<PathMap>$(MSBuildThisFileDirectory)=C:\MyNewPath</PathMap>
<DebugType>full</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions PdbTests/PdbIssueWithFody/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.IO;
using System.Reflection;

namespace PdbIssueWithFody
{
public class Program
{
public static void Main()
{
var assembly = typeof(Program).Assembly;
}
}
}
10 changes: 10 additions & 0 deletions PdbTests/PdbIssueWithoutFody/PdbIssueWithoutFody.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<PathMap>$(MSBuildThisFileDirectory)=C:\MyNewPath</PathMap>
<DebugType>full</DebugType>
</PropertyGroup>

</Project>
14 changes: 14 additions & 0 deletions PdbTests/PdbIssueWithoutFody/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.IO;
using System.Reflection;

namespace PdbIssueWithoutFody
{
public class Program
{
public static void Main()
{
var assembly = typeof(Program).Assembly;
}
}
}