[.Net] jsreport rendering issue



  • Im trying to build a simple report:

    <!DOCTYPE html>

    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta charset="utf-8" />
    <title></title>
    </head>
    <body>
    <hr />
    <div class="notes">
    {{#each notes}}
    <p>{{this}}</p>
    {{/each}}
    </div>
    </body>
    </html>

                var content = new StreamReader("Resources/Templates/Invoice/INVOICE_REPORT.html").ReadToEnd();
    
                var report = await rs.RenderAsync(new RenderRequest()
                {
                    Template = new Template()
                    {
                        Recipe = Recipe.PhantomPdf,
                        Engine = Engine.Handlebars,
                        Content = content
                    },
                    Data = new
                    {
                        notes = new string[] { "note 1", "note 2"}
                    }
                });
    

    but it throws this, am i doing something wrong?:

    JsReportBinaryException: Error rendering report: rendering has finished with errors:Error: An error occurred while trying to execute the command: at onCriticalError ([eval]:29603:25) at tryCatcher ([eval]:36038:23) at Promise._settlePromiseFromHandler ([eval]:34061:31) at Promise._settlePromise ([eval]:34118:18) at Promise._settlePromise0 ([eval]:34163:10) at Promise._settlePromises ([eval]:34238:18) at Async._drainQueue ([eval]:31008:16) at Async._drainQueues ([eval]:31018:10) at Immediate.Async.drainQueues [as _onImmediate] ([eval]:30892:14) at processImmediate [as _immediateCallback] (timers.js:396:17) {"originalError":{"remoteStack":"TypeError: Cannot use 'in' operator to search for '$ref' in note 1\n at recurse (jsreportRuntime.js:139000:26)\n at recurse (jsreportRuntime.js:139025:22)\n at module.exports (jsreportRuntime.js:139033:5)\n at module.exports (jsreportRuntime.js:124:17)\n at ScriptsManager.execute (jsreportRuntime.js:263763:34)\n at tryCatcher (jsreportRuntime.js:47291:23)\n at ret (eval at <anonymous> (jsreportRuntime.js:45949:12), <anonymous>:13:39)\n at invokeRender (jsreportRuntime.js:138903:88)\n at jsreportRuntime.js:138965:12\n at tryCatcher (jsreportRuntime.js:47291:23)\n at Promise._settlePromiseFromHandler (jsreportRuntime.js:45313:31)\n at Promise._settlePromise (jsreportRuntime.js:45370:18)\n at Promise._settlePromise0 (jsreportRuntime.js:45415:10)\n at Promise._settlePromises (jsreportRuntime.js:45494:18)\n at Promise._fulfill (jsreportRuntime.js:45439:18)\n at Promise._resolveCallback (jsreportRuntime.js:45233:57)\n at Promise._settlePromiseFromHandler (jsreportRuntime.js:45325:17)\n at Promise._settlePromise (jsreportRuntime.js:45370:18)\n at Promise._settlePromise0 (jsreportRuntime.js:45415:10)\n at Promise._settlePromises (jsreportRuntime.js:45494:18)\n at Promise._fulfill (jsreportRuntime.js:45439:18)\n at Promise._resolveCallback (jsreportRuntime.js:45233:57)\n at Promise._settlePromiseFromHandler (jsreportRuntime.js:45325:17)\n at Promise._settlePromise (jsreportRuntime.js:45370:18)\n at Promise._settlePromise0 (jsreportRuntime.js:45415:10)\n at Promise._settlePromises (jsreportRuntime.js:45494:18)\n at Promise._fulfill (jsreportRuntime.js:45439:18)\n at PromiseArray._resolve (jsreportRuntime.js:45704:19)\n at PromiseArray._promiseFulfilled (jsreportRuntime.js:45722:14)\n at Promise._settlePromise (jsreportRuntime.js:45375:26)\n at Promise._settlePromise0 (jsreportRuntime.js:45415:10)\n at Promise._settlePromises (jsreportRuntime.js:45494:18)\n at Async._drainQueue (jsreportRuntime.js:42220:16)\n at Async._drainQueues (jsreportRuntime.js:42230:10)\n at Immediate.Async.drainQueues [as _onImmediate] (jsreportRuntime.js:42104:14)\n at processImmediate [as _immediateCallback] (timers.js:396:17)"}}(Original) Error: Error during rendering report: Cannot use 'in' operator to search for '$ref' in note 1 at [eval]:36644:23 at ConcatStream.<anonymous> ([eval]:42366:43) at emitNone (events.js:72:20) at ConcatStream.emit (events.js:166:7) at finishMaybe ([eval]:4229:14) at afterWrite ([eval]:4115:3) at nextTickCallbackWithManyArgs (node.js:486:18) at process._tickCallback (node.js:384:17) {"remoteStack":"TypeError: Cannot use 'in' operator to search for '$ref' in note 1\n at recurse (jsreportRuntime.js:139000:26)\n at recurse (jsreportRuntime.js:139025:22)\n at module.exports (jsreportRuntime.js:139033:5)\n at module.exports (jsreportRuntime.js:124:17)\n at ScriptsManager.execute (jsreportRuntime.js:263763:34)\n at tryCatcher (jsreportRuntime.js:47291:23)\n at ret (eval at <anonymous> (jsreportRuntime.js:45949:12), <anonymous>:13:39)\n at invokeRender (jsreportRuntime.js:138903:88)\n at jsreportRuntime.js:138965:12\n at tryCatcher (jsreportRuntime.js:47291:23)\n at Promise._settlePromiseFromHandler (jsreportRuntime.js:45313:31)\n at Promise._settlePromise (jsreportRuntime.js:45370:18)\n at Promise._settlePromise0 (jsreportRuntime.js:45415:10)\n at Promise._settlePromises (jsreportRuntime.js:45494:18)\n at Promise._fulfill (jsreportRuntime.js:45439:18)\n at Promise._resolveCallback (jsreportRuntime.js:45233:57)\n at Promise._settlePromiseFromHandler (jsreportRuntime.js:45325:17)\n at Promise._settlePromise (jsreportRuntime.js:45370:18)\n at Promise._settlePromise0 (jsreportRuntime.js:45415:10)\n at Promise._settlePromises (jsreportRuntime.js:45494:18)\n at Promise._fulfill (jsreportRuntime.js:45439:18)\n at Promise._resolveCallback (jsreportRuntime.js:45233:57)\n at Promise._settlePromiseFromHandler (jsreportRuntime.js:45325:17)\n at Promise._settlePromise (jsreportRuntime.js:45370:18)\n at Promise._settlePromise0 (jsreportRuntime.js:45415:10)\n at Promise._settlePromises (jsreportRuntime.js:45494:18)\n at Promise._fulfill (jsreportRuntime.js:45439:18)\n at PromiseArray._resolve (jsreportRuntime.js:45704:19)\n at PromiseArray._promiseFulfilled (jsreportRuntime.js:45722:14)\n at Promise._settlePromise (jsreportRuntime.js:45375:26)\n at Promise._settlePromise0 (jsreportRuntime.js:45415:10)\n at Promise._settlePromises (jsreportRuntime.js:45494:18)\n at Async._drainQueue (jsreportRuntime.js:42220:16)\n at Async._drainQueues (jsreportRuntime.js:42230:10)\n at Immediate.Async.drainQueues [as _onImmediate] (jsreportRuntime.js:42104:14)\n at processImmediate [as _immediateCallback] (timers.js:396:17)"}

    Edit 1: Awesome library!
    Edit 2: using JsonConvert.SerializeObject is a workaround for the issue


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.