Under Review
Last Updated: 28 Jun 2021 09:10 by ADMIN
Frantisek
Created on: 29 Mar 2021 12:03
Type: Bug Report
1
GetAggregateFunctionsNullReferenceException

Hello

 

I have problem with visual studio auto close when I'm working in reporting designer.

When I'm working in reporting designer and do about 5 changes, Visual studio freezes and after few monents is restarted and I loose all my work.

It is really frequented problem and I can hardly work with reporting designer.

 

In Windows Event Viewer I everytime find this exception that referes to problem in GetAggregateFunctions().

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException

Server stack trace: 
   at Telerik.Reporting.Processing.AggregateFunctionHelper.GetAggregateFunctions(IServiceProvider provider)
   at Telerik.Reporting.Design.Common.ExpressionBuilder.CategoryAdapter.<GetAggregates>d__1b.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at Telerik.Reporting.Design.Common.ExpressionBuilder.CategoryAdapter.FillAggregates(Category funcCategory, IServiceProvider provider)
   at Telerik.Reporting.Design.Common.ExpressionBuilder.CategoryAdapter.CreateHierarchy(IServiceProvider provider, Boolean isFieldsTreeVisible)
   at Telerik.Reporting.Design.Common.ExpressionBuilder.ExpressionBuilderDialog.LoadCategories(IServiceProvider provider)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(System.Runtime.Remoting.Messaging.Message, Boolean)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(System.Object, System.Runtime.Remoting.Proxies.MessageData ByRef)
   at Telerik.Reporting.Design.Common.ExpressionBuilder.ExpressionBuilderDialog+LoadCategoriesDelegate.EndInvoke(System.IAsyncResult)
   at Telerik.Reporting.Design.Common.ExpressionBuilder.ExpressionBuilderDialog.OnLoadCategoriesComplete(System.IAsyncResult)
   at System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessageSink)
   at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.DoAsyncCall()
   at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(System.Object)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

11 comments
ADMIN
Neli
Posted on: 28 Jun 2021 09:10

Hello Frantisek,

I am sorry to hear that you are still experiencing issues with using the functions.

May I ask which framework the project targets? Also, the project that contains the logic for the functions? Please, make sure that the dependent assemblies don't have their own dependent assemblies. You may also test the approach from Assembly Used in ObjectDataSource is Not Loaded by the Standalone Report Designer KB article.

When it comes to "I still don't understand why some reports, that no use aggregate functions - shotdown very often and some don't shutdown any time.", in such situations if you have attached Trace Listener, the generated log file should provide more information. 

Regards,


Neli
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Frantisek
Posted on: 21 Jun 2021 09:16

Hello Todor,

 

The mentioned .dll has already been added. I don't know, why that log says, that Mn_Settings and ValidationSupports are not there. It is normaly working.

It is possible, that VisualStudio don't see that .dll for another reason - I try delete all bin and obj directories for reload all assemblies - and try some another workarounds - but no one are working.

I still don't understand why some reports, that no use aggregate functions - shotdown very often and some don't shutdown any time.

I could try delete code that use this namespaces and look what happend - but it is drastic solution.

Do you have some another advice for me?

 

Best Regards,

Frantisek

ADMIN
Todor
Posted on: 11 May 2021 13:04

Hi Frantisek,

Thank you for the logs.

I noticed that the assemblies Mn_Settings and ValidationSupport cannot be loaded for some reason. They seem to be dependencies for the functions GetReport in type Mn_Mirror.Reporting.ReportExtensions and IsCorrespondingVatRate in type Mn_Mirror.Reporting.ReportFeatures, correspondingly. Mn_Mirror.Reporting seems to be the namespace/assembly with the aggregate functions you sent previously.

Note that the log specifies where the Visual Studio has attempted to find the dlls. I suggest adding the assemblies in one of these paths and checking whether the issue would be resolved.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Frantisek
Posted on: 05 May 2021 10:27

Hello Todor,

 

I attach Logs.zip file with ActivityLog of Visual Studio and TextWriterOutput from listener.

I believe this will help solve my problem.

 

Best Regards

Frantisek

Attached Files:
ADMIN
Todor
Posted on: 05 May 2021 06:51

Hello Frantisek,

The error message states that there is a problem while loading the aggregate functions. It is not necessary for the report to use an aggregate function. Our code tries to load the functions from the available assemblies in order to use them if they occur in an Expression. Here is the code of the function:

public static IList<AggregateFunctionInfo> GetAggregateFunctions(IServiceProvider provider)
{
    var list = new List<AggregateFunctionInfo>();
    var loader = new AggregateFunctionLoader(list)
        .LoadFrom(AppDomain.CurrentDomain.GetAssemblies());

    if(null != provider)
    {
        loader.LoadFrom(((AssemblyRefManager)provider.GetService(typeof(AssemblyRefManager))).GetAssemblies());
        var discoSvc = (ITypeDiscoveryService)provider.GetService(typeof(ITypeDiscoveryService));
        ICollection types = null;
        try
        {
            types = discoSvc?.GetTypes(typeof(IAggregateFunction), true);
            if (null != types)
            {
                loader.LoadFrom(types.Cast<Type>());
            }
            else
            {
                Trace.WriteLine("TypeDiscoveryService.GetTypes returns null.");
            }
        }
        catch (Exception ex)
        {
            Trace.WriteLine("Exception occur while resolving the aggregates:");
            Trace.WriteLine(ex);
        }
    }

    
    // Design time uses only the Visible aggregates
    return list.FindAll(info => info.IsVisible);
}

I cannot see a potential source for the unhandled null reference exception.

To troubleshoot further, can you attach a trace listener to the Visual Studio application? Please, see the article section Visual Studio Crashes for more details. I hope the trace log will give more information on what exactly fails and why.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Frantisek
Posted on: 28 Apr 2021 08:37

Hello Todor,

I don't use previewing a report from Visual Studio Report Designer.

I actually don't know if the problem is in using Agregate function on report. Because error occurs even if I working in Report Designer on report without used Agregate functions.

It must be another problem - i think that Report Designer must working with files that I don't have oppened and aren't in subreports. Or error don't say true - throw bad error.

Can we log error in Telerik Report Designer? (I don't think in running application - I use ReportViewer.Error and other Error catchers. In running application is not problem).

Regards,

Frantisek


ADMIN
Todor
Posted on: 20 Apr 2021 06:58

Hello Frantisek,

Thank you for the provided resources. I modified the code of WeekDayAgregate.cs and MonthDayAgregate.cs to compensate for the lack of two custom assemblies and created the IDatePrint interface. I added the functions to our demo ReportLibrary project. They were recognized by the designer - see the linked screenshot. I modified one of our demo reports multiple times using the custom aggregates. I didn't experience any issues.

Do you observe the problem when previewing a report using the custom aggregates from Visual Studio Report Designer? If so, please, note that custom aggregates are not supported when you preview the report in Visual Studio. To see the aggregate output, use a ReportViewer control. See Extending Reporting Engine with User Functions article section for more details.

Regards,
Todor
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Frantisek
Posted on: 13 Apr 2021 12:09

Hello Todor,

sorry, that was my mistake. Now, it will not be empty.

 

Reards,

Frantisek

ADMIN
Todor
Posted on: 13 Apr 2021 08:40

Hi Frantisek,

I'm afraid the attached archive is empty - see the linked screenshot for reference. Note that the GUID before the archive name is attached automatically by our system.

Regards,
Todor
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Frantisek
Posted on: 06 Apr 2021 12:51

Hello Todor,

 

I attach CustomAgregateFunctions.zip that contains files with classes that represents my custom agregate functions.

 

Regards,

Frantisek

Attached Files:
ADMIN
Todor
Posted on: 05 Apr 2021 09:45

Hi Frantisek,

Indeed, the Stack trace of the error indicates that the designer cannot find the Aggregate Functions. Do you use any custom aggregate functions? Or other custom types that need to be resolved by the designer? If so, can you send us the custom types to test locally?

We are aware of an issue where Visual Studio cannot resolve some types. Note that we don't guarantee this as the designer utilizes the ITypeDiscoveryService Interface to discover available types at design time and we cannot control it. A similar error is discussed in the ITypeDiscoveryService.GetTypes is throwing exceptions thread started by one of our developers.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.