Crash while building after update to SmartAssembly 7.4.2.3588

clinkeclinke Posts: 10 New member
Dear sir or madam,

after updating to SmartAssembly 7.4.2.3588, we are not able to bild our project anymore. I've already sent an error report, this is the stack trace:
Loading...
Starting...
Analyzing...
Preparing...
Creating assembly...
Failed
SmartAssembly.InformationException: An error occurred while writing the assembly
 to disk:

Unable to resolve type System.Collections.Generic.List`1 in assembly System.Coll
ections, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

If you think this is a bug in SmartAssembly, please retry in the GUI and send th
e error to Red Gate. ---> SmartAssembly.Engine.TypeResolutionException: Unable t
o resolve type System.Collections.Generic.List`1 in assembly System.Collections,
 Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
   bei ♠.↨.☺(TypeReference ☻, TypeDefinition& ♥, Boolean )
   bei ♠.↨.☺(TypeReference )
   bei SmartAssembly.Engine.Metadata.TypeReference.☺(TypeReference )
   bei ☼.‼.☺(ITypeDefOrRef , ITypeDefOrRef )
   bei ?.☺(ElementType )
   bei §.↕.☺(ElementType )
   bei SmartAssembly.Engine.Metadata.TypeSpecification.☺(TypeSpecification )
   bei SmartAssembly.Engine.Metadata.TypeSpecification.☺(Object )
   bei SmartAssembly.Engine.Metadata.MemberReference`2.☺(ITypeDefOrRefOrSpec , I
TypeDefOrRefOrSpec )
   bei SmartAssembly.Engine.Metadata.MemberReference`2.☺(MemberReference`2 )
   bei SmartAssembly.Engine.Metadata.MemberReference`2.Equals(Object )
   bei System.Collections.Generic.ObjectEqualityComparer`1.Equals(T x, T y)
   bei System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   bei System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& val
ue)
   bei SmartAssembly.Engine.Writer.TableDataGenerator.☺(☼ )
   bei ♠.↨.☺(Object , MethodBodyWriter )
   bei ♠.↨.☺(MethodBodyWriter , ‼ , Object )
   bei ♠.↨.☺(MethodBodyWriter , Instruction )
   bei ♠.↨.☺(♣ , MethodBodyWriter )
   bei ♠.↨.☺(♣& ☻, MethodBody ♥, IDictionary`2 ♦, MethodBodyWriter )
   bei ♠.↨.☺(MethodBody ☻, MethodBodyWriter ♥, Dictionary`2& )
   bei SmartAssembly.Engine.Writer.TableDataGenerator.☺()
   bei ♠.↨.☺ )
   bei ♠.↨.☺(FileInfo , IAssembly , ProcessingProjectHelper , IAssemblyWriterOpt
ions )
   bei ♠.↨.☺(String ☻, ProcessingProjectHelper ♥, IAssembly ♦, Configuration )
   bei SmartAssembly.ProcessingProjectHelper.☻()
   --- Ende der internen Ausnahmestapelüberwachung ---


SmartAssembly has encountered an error while running your project.
Failed: SmartAssembly.InformationException: An error occurred while writing the
assembly to disk:

Unable to resolve type System.Collections.Generic.List`1 in assembly System.Coll
ections, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

If you think this is a bug in SmartAssembly, please retry in the GUI and send th
e error to Red Gate. ---> SmartAssembly.Engine.TypeResolutionException: Unable t
o resolve type System.Collections.Generic.List`1 in assembly System.Collections,
 Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
   bei ♠.↨.☺(TypeReference ☻, TypeDefinition& ♥, Boolean )
   bei ♠.↨.☺(TypeReference )
   bei SmartAssembly.Engine.Metadata.TypeReference.☺(TypeReference )

Please assist urgently, because our build processes are failing. Many thanks in advance.

Kind regards

Christian Linke

Tagged:

Answers

  • clinkeclinke Posts: 10 New member
    Addition: This is a .NET Standard 2.0 project; it also fails on other projects of the same type.
  • mrmiagi0101mrmiagi0101 Posts: 20 Bronze 1
    On my local machine I have the same error. I build the sa project from the SA gui and I send the error report to you.
  • mrmiagi0101mrmiagi0101 Posts: 20 Bronze 1
    Ok, I found the problem. Somewhere between 7.2.x and 7.4.x Redgate changed the behavior for .NET Standard assemblies. The problem is, if you have the projectname.dep.json file not next to the dll, SmartAssembly is throwing the exception now.
    But this is often the case, because if you build e.g. a WPF exe referencing a .NET Standard project, Visual Studio will never copy the json file from the referenced assembly to output folder of the WPF project. If you now try to build the sa project for the .NET Standard dll located in wpf output folder, you will get the exception. By copying the json manually to this folder, SA is working again.
    @Redgate: Can build in a fallback if the json is not there to work with old behavior?
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi both!

    I unfortunately haven't been able to reproduce this yet, but with regard to your question @mrmiagi0101
    , I know there was some work done as of 7.4.2 so that if the .deps.json not found, SmartAssembly will do further searching to try to locate it. (There is also a feature request SA-2319 which hasn't been implemented yet, but requests that SmartAssembly point out if the file can't be found and prompt you for the correct location- I've +1'd this with your feedback.)

    You can though add the following task to the .csproj file which will copy .deps.json file to the output folder as needed:

    <Target Name="WorkaroundForSmartAssembly_CopyDeps" BeforeTargets="PostBuildEvent">
      <Copy SourceFiles="$(OutDir)$(ProjectName).deps.json" DestinationFolder="$(OutDir)bin" Condition="Exists('$(OutDir)$(ProjectName).deps.json')"/>
    </Target>

    Then if required, the file can be removed after SmartAssembly build is done:
    <Target Name="WorkaroundForSmartAssembly_RemoveDeps" AfterTargets="BuildWithSmartAssembly">
      <Delete Files="$(OutDir)bin\$(ProjectName).deps.json" Condition="Exists('$(OutDir)bin\$(ProjectName).deps.json')"/>
    </Target>

    If you are still running into a different issue though @clinke, is it possible for you to share you assemblies with us to test with locally? You can send it to [email protected] with subject "Files for SmartAssembly issue #162320"

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • mrmiagi0101mrmiagi0101 Posts: 20 Bronze 1
    "prompt you for the correct location". How should this work without gui? We are building on build server.

    <Target Name="WorkaroundForSmartAssembly_CopyDeps" BeforeTargets="PostBuildEvent">
      <Copy SourceFiles="$(OutDir)$(ProjectName).deps.json" DestinationFolder="$(OutDir)bin" Condition="Exists('$(OutDir)$(ProjectName).deps.json')"/>
    </Target>

    Where do we have to place this? In every .net Standard project we are referencing in out executable project? This is not a solution!

    Why can you not just have a fallback to the old behavior. Or how it was working in Version 7.2.1? With this version everything is fine on build server.

  • clinkeclinke Posts: 10 New member
    Unfortunately this is no solution for us. Many dependencies of our project are resolved by NuGet-packages. These are not provided with .json-files. So on a multi-assembly solution, providing the .json-file is not an option. As mrmiagi0101 says, we need a fallback.
  • mrmiagi0101mrmiagi0101 Posts: 20 Bronze 1
    Any news here?
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi all,

    So sorry for the delay!

    I've escalated the issue but we just want to make sure we are understanding the issue correctly. Would it be possible for either of you to share a reproduction to test with?

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Sign In or Register to comment.