Serenity: Possible breaking change in 3.5.2

Created on 19 Feb 2018  路  22Comments  路  Source: serenity-is/Serenity

Hello there. After updating Serenity packages from 3.4.4 to 3.5.2, I'm getting an error in T4 template transformation. Updated all packages including Web Tooling. Project is traditional .NET 45. Any suggestions?

Compiling transformation: 'InterfaceImplementation' does not contain a definition for 'FullName' and no extension method 'FullName' accepting a first argument of type 'InterfaceImplementation' could be found (are you missing a using directive or an assembly reference?)   Miscellaneous Files xxx.Web\Imports\ClientTypes\..\CodeGenerationHelpers.ttinclude  167 

Most helpful comment

You need to also upgrade Serenity.Web.Tooling before doing that change

All 22 comments

Volkan already answered:
replace externalType.Interfaces.Add(intf.FullName) with externalType.Interfaces.Add(intf.InterfaceType.FullName)
=> (it worked for me).

anyway, Try to update to 3.5.4 (latest version)

Thanks for quick response. I tried this and new error results, this time in the ServerTypings.tt
Also updated packages to 3.5.4 and same result.

Error       Running transformation: System.NullReferenceException: Object reference not set to an instance of an object.
   at Serenity.CodeGeneration.CecilImportGenerator.CanHandleType(TypeDefinition memberType) in C:\Projects\StartSharp\Serenity\Serenity.CodeGenerator\CodeGeneration\Base\CecilImportGenerator.cs:line 194
   at Serenity.CodeGeneration.ServerTypingsGenerator.<>c__DisplayClass5_0.<GenerateBasicType>b__1(TypeReference memberType, String memberName, IEnumerable`1 a) in C:\Projects\StartSharp\Serenity\Serenity.CodeGenerator\CodeGeneration\ServerTypings\ServerTypingsGenerator.cs:line 107
   at Serenity.CodeGeneration.ServerTypingsGenerator.<>c__DisplayClass5_0.<GenerateBasicType>b__0() in C:\Projects\StartSharp\Serenity\Serenity.CodeGenerator\CodeGeneration\ServerTypings\ServerTypingsGenerator.cs:line 101
   at Serenity.Reflection.CodeWriter.InBrace(Action insideBlock) in C:\Projects\StartSharp\Serenity\Serenity.Core\Reflection\CodeWriter.cs:line 45
   at Serenity.CodeGeneration.ServerTypingsGenerator.GenerateBasicType(TypeDefinition type) in C:\Projects\StartSharp\Serenity\Serenity.CodeGenerator\CodeGeneration\ServerTypings\ServerTypingsGenerator.cs:line 99
   at Serenity.CodeGeneration.ServerTypingsGenerator.<>c__DisplayClass4_1.<GenerateCodeFor>b__1() in C:\Projects\StartSharp\Serenity\Serenity.CodeGenerator\CodeGeneration\ServerTypings\ServerTypingsGenerator.cs:line 44
   at Serenity.Reflection.CodeWriter.InBrace(Action insideBlock) in C:\Projects\StartSharp\Serenity\Serenity.Core\Reflection\CodeWriter.cs:line 45
   at Serenity.CodeGeneration.ServerTypingsGenerator.<>c__DisplayClass4_0.<GenerateCodeFor>b__0(Action`1 action) in C:\Projects\StartSharp\Serenity\Serenity.CodeGenerator\CodeGeneration\ServerTypings\ServerTypingsGenerator.cs:line 42
   at Serenity.CodeGeneration.ServerTypingsGenerator.GenerateCodeFor(TypeDefinition type) in C:\Projects\StartSharp\Serenity\Serenity.CodeGenerator\CodeGeneration\ServerTypings\ServerTypingsGenerator.cs:line 79
   at Serenity.CodeGeneration.CecilImportGenerator.GenerateAll() in C:\Projects\StartSharp\Serenity\Serenity.CodeGenerator\CodeGeneration\Base\CecilImportGenerator.cs:line 184
   at Serenity.CodeGeneration.ServerTypingsGenerator.GenerateAll() in C:\Projects\StartSharp\Serenity\Serenity.CodeGenerator\CodeGeneration\ServerTypings\ServerTypingsGenerator.cs:line 30
   at Microsoft.VisualStudio.TextTemplating94C26B6604256E74C3E65A10A316556AA1B02CC6EB1D555CD8158FBF98FECBED8A38792F0DA15BB9B62C88B9D76FE0C9EA7A88C9EF9B9BAB46BC3461479F9CE1.GeneratedTextTransformation.TransformText() PWB.Web C:\Users\antho\Documents\Dev\Projects\PWB\PWB\PWB.Web\Imports\ServerTypings\ServerTypings.tt    1   

Cecil returns null for some memberType.Resolve() in your project, hard to now which

I also met this issue
image
The T returns null

Thanks, that will help a lot

After upgrade to latest serenity and replace externalType.Interfaces.Add(intf.InterfaceType.FullName) , I got this error:

Compiling transformation: 'TypeReference' does not contain a definition for 'InterfaceType' and no extension method 'InterfaceType' accepting a first argument of type 'TypeReference' could be found (are you missing a using directive or an assembly reference?)
C:\Users\admin\source\repos\Serene2\Serene2.Web\Imports\ClientTypes..\CodeGenerationHelpers.ttinclude 167

You need to also upgrade Serenity.Web.Tooling before doing that change

e.g. Cecil under tools\Cecil should be 0.10.0 version, not 0.9.5

If you don't use Saltaralle at all (e.g. C# to Javascript compiler), you may also remove SSTypeLister class in CodeGenerationHelpers.include along with these lines in ServerTypings.tt and ClientTypes.tt:

    if (System.IO.File.Exists(solutionDir + @"Marmara.Script.Site\Marmara.Script.Site.csproj"))
    {
        var ssDir = solutionDir + @"Marmara.Script.Site\bin\debug\";
        var ssTypeLister = new SSTypeLister(
            ssDir + "Serenity.Script.Imports.dll",
            ssDir + "Serenity.Script.UI.dll",
            ssDir + "Marmara.Script.Site.dll");
        var ssTypes = ssTypeLister.List();
        foreach (var type in ssTypes)
            generator.AddSSType(type);
    }

```

if (System.IO.File.Exists(solutionDir + @"Marmara.Script.Site\Marmara.Script.Site.csproj"))
{
    var ssDir = solutionDir + @"Marmara.Script.Site\bin\debug\";
    var ssTypeLister = new SSTypeLister(
        ssDir + "Serenity.Script.Imports.dll",
        ssDir + "Serenity.Script.UI.dll",
        ssDir + "Marmara.Script.Site.dll");
    var ssTypes = ssTypeLister.List();
    foreach (var type in ssTypes)
        generator.AddSSType(type);
}

````

After upgrade Serenity.Web.Tooling it worked, thanks !

@likeshan168 can you tell me what is the file name of generated .ts file under ServerTypings.ts in old version for this file (BatchUpdateRequest.ts?) and share the code generated?

Is it?
image

image
image

OK, thanks

found something similar
image

image

image

and the debug info is
image

Can you try with 3.5.5, it should be available in 5 mins+

ok, I will try when it is available

Well it stuck in validating in NuGet server, so might take some time

fixed for me thx. issue was the <SlingRow> in the SlingPriceRequest class definition. TS Class signature now looks like:

namespace PWB.SlingMate.Services {
    export interface SlingPriceRequest extends Serenity.ServiceRequest {
        Entity?: SlingRow;
        EntityId?: number;
        IsNew?: boolean;
        DistributorId?: number;
        PriceModelId?: number;
    }
}

it also fix my issue, thanks

Same Proble With NetCore version LastVersion :(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Amitloh picture Amitloh  路  3Comments

stixoffire picture stixoffire  路  3Comments

Pinellus picture Pinellus  路  3Comments

newyearsoft picture newyearsoft  路  3Comments

stepankurdylo picture stepankurdylo  路  3Comments