Giter Club home page Giter Club logo

thor-generator's Issues

Generation fails when the EventSource Interface contains a collection parameter

Hi,

We have an interface that contains a method which has a parameter that is a collection.

[EventSourceDefinition(Name = "xxx")]
public interface IXXXEventSource
{
    [Event(1, Level = EventLevel.Warning,
        Message = "XXX", Version = 4)]
    void SomeXXXs(List<string> xxxs);
}

The Thor Generator v1.3.3 currently fails to generate the class for this interface. We get the following error in the console output:

Processing \src\EventSources\EventSources.csproj -> \src\EventSources\EventSources.csproj ...
1>
1>Unhandled Exception: System.ArgumentNullException: Value cannot be null.
1>Parameter name: type
1> at Thor.Generator.Templates.ModelExtensions.AddParameter(EventModel eventModel, String name, String type) in C:\thor\generator\src\Generator\Templates\ModelExtensions.cs:line 65
1> at Thor.Generator.Templates.EventSourceDefinitionVisitor.VisitMethodDeclaration(MethodDeclarationSyntax node) in C:\thor\generator\src\Generator\Templates\EventSourceDefinitionVisitor.cs:line 85
1> at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker.Visit(SyntaxNode node)
1> at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker.DefaultVisit(SyntaxNode node)
1> at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker.Visit(SyntaxNode node)
1> at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker.DefaultVisit(SyntaxNode node)
1> at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker.Visit(SyntaxNode node)
1> at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker.DefaultVisit(SyntaxNode node)
1> at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker.Visit(SyntaxNode node)
1> at Thor.Generator.EventSourceResolver.d__3.MoveNext() in C:\thor\generator\src\Generator\EventSourceResolver.cs:line 33
1> at Thor.Generator.EventSourceGenerator.Generate() in C:\thor\generator\src\Generator\EventSourceGenerator.cs:line 39
1> at Thor.Generator.Tasks.EventSourceGeneratorTaskBase.GenerateEventSources(Project source, Project target) in C:\thor\generator\src\Generator\Tasks\EventSourceGeneratorTaskBase.cs:line 123
1> at Thor.Generator.Tasks.ProjectEventSourceGeneratorTask.Execute() in C:\thor\generator\src\Generator\Tasks\ProjectEventSourceGeneratorTask.cs:line 77
1> at Thor.Generator.CLI.Program.Main(String[] args) in C:\thor\generator\src\Generator.CLI\Program.cs:line 20
1> .nuget\packages\thor.generator\1.3.3\build\Thor.Generator.targets(16,5): error MSB3073: The command "".nuget\packages\thor.generator\1.3.3\build..\tools\win10-x64\thorgen.exe" project -s "\src\EventSources\EventSources.csproj" -t "\src\EventSources\EventSources.csproj"" exited with code -532462766.
1>Done building project "EventSources.csproj" -- FAILED.

There is an easy workaround for this issue: use a wrapper class around the collection and have the parameter be of that type.

Support for large payloads.

The current generator will only accept value types and string as payloads to be compliant with etw. There are cases were customers still want to generate an event source with custom objects for which they handle the payload serialisation in an nonevent method.

The template info file should define which types are accepted by a template. Moreover, a template should explicitly in- or exclude types or work with wildcards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.