Admin viewer for AutoQuery not working in Core

I’ve added the AutoQuery Admin plugin to a project that we have started in .NET CORE, however, I am unable to use the viewer, I consistently get an error in the React UI (I know zero about react, unfortunately). The page halts before anything loads, with a gray background but no UI elements visible. Swagger , works fine.

I have a single request that uses autoquery:

[Route("/query/SomethingWierdToTest", HttpMethods.Get)]
public class QuerySomethingWierdToTest : QueryDb<SomethingWierdToTest>

public class SomethingWierdToTest
	public int Id { get; set; }

The error is:

Uncaught (in promise) TypeError: t.attributes.filter is not a function
at t.getAutoQueryViewer (AutoQuery.tsx:87)
at AutoQuery.tsx:41
at Array.forEach ()
at new t (AutoQuery.tsx:39)
at p._constructComponentWithoutOwner (ReactCompositeComponent.js:297)
at p._constructComponent (ReactCompositeComponent.js:284)
at p.mountComponent (ReactCompositeComponent.js:187)
at Object.mountComponent (ReactReconciler.js:45)
at p._updateRenderedComponent (ReactCompositeComponent.js:764)
at p._performComponentUpdate (ReactCompositeComponent.js:723)

I downloaded the Admin code and attempted to run that to test as well, but am having a few issues launching any of the projects there. Is the ADMIN up to date in .CORE or a similar story to the MiniProfiler?

AutoQuery Viewer works fine on .NET Core, e.g:

Does the Network inspector show any error responses?

No, the only error to show is in the console (the one I pasted originally).

I downloaded the northwind core project and run that, it works as advertised.

In my project however, as best I can tell, the line:

const type = etc etc


 getAutoQueryViewer(name:string) {
    const type = this.getType(name);
    return type != null && type.attributes != null
        ? type.attributes.filter(attr => === "AutoQueryViewer")[0]
        : null;

comes back “not defined” from the call to :

getType(name: string) {
    return this.props.metadata.types.filter(op => === name)[0];

no matter what request name is being checked on the page initialization (eg QueryResources, QueryStuff, etc).

I comment out my autoquery request messages one by one and the same error happens, only it moves to the next message type from those remaining… so its like there isnt an issue with a particular autoquery (because i can actually query the endpoint using autoquery), but I am somehow misconfiguring my application such that the Admin plugin fails.

This is running localhost on IIS Express, but I am not sure where to start trying to debug this. Suggestions?

Can you provide a screenshot for the output of console.log(type,type.attributes)? If any of those are null or undefined can you also provide a screenshot of console.log(this.props.metadata) as well please.

I have another project that seems to work with 5.0.2 libs, I am attempting to update that to 5.0.3 (becuase the first project served as the base for the other one…copy pasted code, then updated libs) Thats all i can think of at the moment, but I will investigate more and get back to you with the screenshots and more details

Going to bed now, but think I have solved it. It appears to be the fact that I have my table classes in Autoquery , extending a base table (or even two, at times). The actual autoquery calls handle this fine… the admin feature, not so much.


public class CountryTbl : SoftDeletedTable

	public CountryCodeIso3166A2 Iso3166A2 { get; set; }

	[Index(Unique = true)]
	[StringLength(3, 3)]
	public CountryCodeIso3166A3 Iso3166A3 { get; set; }

public abstract class SoftDeletedTable : BaseTable, IHasSoftDelete
	public bool IsDeleted { get; set; }

public abstract class BaseTable : IHasTimeStamp
	public byte[] RowVersion { get; set; }

So, this works:

public class QueryCountryTbl : QueryDb<ThisWorks_CountryTableNotExtendingOtherClass>


public class ThisWorks_CountryTableNotExtendingOtherClass

	public CountryCodeIso3166A2 Iso3166A2 { get; set; }

	public CountryCodeIso3166A3 Iso3166A3 { get; set; }


but this doesnt:

public class QueryCountryTbl : QueryDb<CountryTbl>

1 Like

I have returned to this after finding a bit of free time, I went to strip out all the base tables from our codebase, only to find out that the above diagnosis is incorrect.

In my application, even with base tables removed, the AdminUI crashes with the same React error whenever my Services are defined in a project other than the AppHost. (i.e. when i have myapp project, and and myapp.service.messages projects)

I copy and paste a single request to query an Attachment table, (the table POCO i have stripped of all attributes and noise), and the only way i can get the SS Admin UI to render at all is if I copy the (manually defined) Autoquery Service + the autoquery request message, into the same project as my dotnetcore app is running from .

And even when that renders, it is empty, with the “Please Sign In to see your available queries” message. It’s as though having my autoquery dtos and/or services outside the apphost project means they dont get wired up in time for the plugin feature to detect them, or something?

Is that possible/likely? That because they reside in a different project , that they are added to the pipeline too late to be detected / compiled in an AdminUI-friendly way?

That is a small zip file with a cut down solution with a single autoquery request and endpoint that shows the issue, sorry, I can’t remember / see how to add an attachment here.

The queryattachments request in the SomeDemoCustomAutoQueryEndpoint is what I am trying to view and query from the AdminUI plugin, to no avail.

The issue is because the default was changed to:

JsConfig.IncludeNullValues = true;

Commenting that out should make it work. Also you don’t need to set JsConfig.EmitCamelCaseNames = true in .NET Core Apps as it’s enabled by default.

Well… Now i feel somewhat stupid.

What steps did you take to diagnose that, out of interest (so I can avoid rookie questions in future).

Thanks for the heads up about the defaults too.

Chrome’s WebInspector showed the error was trying to access the type.attributes property so had a look at the /autoquery/metadata response to see what was being returned for the attributes property and saw it was null where it would normally contain an array if exists or no property if it didn’t have any values, so then navigated to your AppHost to uncomment the JsConfig.IncludeNullValues which caused null values to be emitted.

Note the latest v5.0.3 that’s now on MyGet should handle null values now as well. Although non default configuration is typically not well tested so I’d recommend avoiding changing the defaults if possible.

1 Like

Same kind of issues on my side. Can’t see my query in the viewer but if I change to QueryData I see it, like:

[Route("/Query/Applications", Verbs = "GET")]
public class QueryApplications : QueryDb<Application> --> QueryData 

I use Safari browser.

Any hints ?