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

MSpec remover fails when MSpec context contains nested class with a reference to another nested class #5

Closed
agross opened this issue Sep 30, 2014 · 2 comments
Milestone

Comments

@agross
Copy link

agross commented Sep 30, 2014

public class Something
{
  It does_not_matter;

  class Parent
  {
    public Child Child { get; set; }
  }

  class Child
  {
  }
}

When running Fody we receive the following NullReferenceException:

MSBUILD : error : Fody: An unhandled exception occurred:\r [d:\somewhere\some.csproj]
MSBUILD : error : Exception:\r [d:\somewhere\some.csproj]
MSBUILD : error : Object reference not set to an instance of an object.\r [d:\somewhere\some.csproj]
MSBUILD : error : StackTrace:\r [d:\somewhere\some.csproj]
MSBUILD : error :    at MSpecRemover.IsMspecField(FieldDefinition fieldDefinition) at c:\TeamCity\buildAgent\work\65b82fbfffdc864f\Fody\Removers\MSpecRemover.cs:line 39.\r [d:\somewhere\some.csproj]
MSBUILD : error :    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)\r [d:\somewhere\some.csproj]
MSBUILD : error :    at MSpecRemover.ContainsMSpecField(TypeDefinition typeDefinition) at c:\TeamCity\buildAgent\work\65b82fbfffdc864f\Fody\Removers\MSpecRemover.cs:line 34.\r [d:\somewhere\some.csproj]
MSBUILD : error :    at MSpecRemover.ShouldRemoveType(TypeDefinition typeDefinition) at c:\TeamCity\buildAgent\work\65b82fbfffdc864f\Fody\Removers\MSpecRemover.cs:line 26.\r [d:\somewhere\some.csproj]
MSBUILD : error :    at ModuleWeaver.<>c__DisplayClass19.<CleanTypesBasedOnRemovers>b__17(IRemover x) at c:\TeamCity\buildAgent\work\65b82fbfffdc864f\Fody\ModuleWeaver.cs:line 86.\r [d:\somewhere\some.csproj]
MSBUILD : error :    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)\r [d:\somewhere\some.csproj]
MSBUILD : error :    at ModuleWeaver.CleanTypesBasedOnRemovers() at c:\TeamCity\buildAgent\work\65b82fbfffdc864f\Fody\ModuleWeaver.cs:line 84.\r [d:\somewhere\some.csproj]
MSBUILD : error :    at ModuleWeaver.Execute() at c:\TeamCity\buildAgent\work\65b82fbfffdc864f\Fody\ModuleWeaver.cs:line 55.\r [d:\somewhere\some.csproj]
MSBUILD : error :    at lambda_method(Closure , Object )\r [d:\somewhere\some.csproj]
MSBUILD : error :    at InnerWeaver.ExecuteWeavers(List`1 weaverInstances) at c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\InnerWeaver.cs:line 90.\r [d:\somewhere\some.csproj]
MSBUILD : error :    at InnerWeaver.Execute() at c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\InnerWeaver.cs:line 31.\r [d:\somewhere\some.csproj]
MSBUILD : error : Source:\r [d:\somewhere\some.csproj]
MSBUILD : error : Scalpel.Fody\r [d:\somewhere\some.csproj]
MSBUILD : error : TargetSite:\r [d:\somewhere\some.csproj]
MSBUILD : error : Boolean IsMspecField(Mono.Cecil.FieldDefinition)\r [d:\somewhere\some.csproj]
MSBUILD : error :  [d:\somewhere\some.csproj]
@SimonCropp SimonCropp added this to the 1.0.2 milestone Oct 25, 2014
@SimonCropp
Copy link
Member

fixed and on nuget

@agross
Copy link
Author

agross commented Oct 25, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants