ngs-doo / TemplaterExamples

Creating reports in .NET and Java
https://templater.info
The Unlicense
48 stars 27 forks source link

Certain conditional formatting causes NullReferenceException #5

Closed Kobus-Smit closed 7 years ago

Kobus-Smit commented 7 years ago

Hi

When I use Revenj.NET version v1.4.1 and Templater v2.5 and also v2.7.5 to create an xlsx file it threw a NullReferenceException exception.

report ABC {
    //...
    templater CreateSpreadsheet 'File.xlsx';
  }
Locator.Resolve<IDocumentReport<ABC>>().Create(abc);

I have simplified my spreadsheet template and delete all the content and it seems a conditional formatting rules causes the problem.

The attached ERROR.xlsx throws the exception and WORKS.xlsx works 😊

ERROR.xlsx

WORKS.xlsx

See the next page for the only difference between the two files.

Please advise.

Thank you.

error

works

System.AggregateException occurred
  HResult=0x80131500
  Message=One or more errors occurred.
  Source=mscorlib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

Inner Exception 1:
WebException: Object reference not set to an instance of an object.System.ArgumentException: Object reference not set to an instance of an object. ---> Revenj.Common.FrameworkException: Error while executing service: Object reference not set to an instance of an object.. Sent data:

$c82fead7-9a9c-495e-b864-957478084660 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at s.a()
   at ag.h()
   at bg.a()
   at bg.b()
   at g.a()
   at ae.Dispose()
   at Revenj.DomainPatterns.DocumentReport.GenerateDocument(Object[] data)
   at RatingSystem.Service.OpenModelVersion.Execute(String modelVersionURI) in Y:\Main.cs:line 115
   at Revenj.Plugins.Server.Commands.ExecuteService.ExecuteServiceCommand`2.Execute[TInput,TOutput](ISerialization`1 input, ISerialization`1 output, IServiceProvider locator, Type serviceType, TInput data)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at Revenj.Plugins.Server.Commands.ExecuteService.ExecuteServiceCommand`2.Execute[TInput,TOutput](ISerialization`1 input, ISerialization`1 output, IServiceProvider locator, Type serviceType, TInput data)
   at Revenj.Plugins.Server.Commands.ExecuteService.Execute[TInput,TOutput](IServiceProvider locator, ISerialization`1 input, ISerialization`1 output, IPrincipal principal, TInput data)
Revenj.Common.FrameworkException: Error while executing service: Object reference not set to an instance of an object.. Sent data:

$c82fead7-9a9c-495e-b864-957478084660 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at s.a()
   at ag.h()
   at bg.a()
   at bg.b()
   at g.a()
   at ae.Dispose()
   at Revenj.DomainPatterns.DocumentReport.GenerateDocument(Object[] data)
   at RatingSystem.Service.OpenModelVersion.Execute(String modelVersionURI) in Y:\Main.cs:line 115
   at Revenj.Plugins.Server.Commands.ExecuteService.ExecuteServiceCommand`2.Execute[TInput,TOutput](ISerialization`1 input, ISerialization`1 output, IServiceProvider locator, Type serviceType, TInput data)
   --- End of inner exception stack trace ---
System.NullReferenceException: Object reference not set to an instance of an object.
   at s.a()
   at ag.h()
   at bg.a()
   at bg.b()
   at g.a()
   at ae.Dispose()
   at Revenj.DomainPatterns.DocumentReport.GenerateDocument(Object[] data)
   at RatingSystem.Service.OpenModelVersion.Execute(String modelVersionURI) in Y:\Main.cs:line 115
   at Revenj.Plugins.Server.Commands.ExecuteService.ExecuteServiceCommand`2.Execute[TInput,TOutput](ISerialization`1 input, ISerialization`1 output, IServiceProvider locator, Type serviceType, TInput data)

Example argument: 
Revenj.Plugins.Server.Commands.ExecuteService+Argument`1[System.Object]
zapov commented 7 years ago

Hi,

looks like a bug in the Templater library. Best course of action would be to send xlsx file which doesnt work to Templater support so they take a look.

Regards, Rikard

Kobus-Smit commented 7 years ago

Thanks Rikard. I forgot to attach the xlsx files to the issue and have attached them now and also sent it to Templater support.

Kobus-Smit commented 7 years ago

Fixed in NGS.Templater v2.7.6

Thank you!