New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderbyDescending on AsQueryable throws exception #1741

Open
mrunks opened this Issue Dec 2, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@mrunks

mrunks commented Dec 2, 2018

When I try use OrderByDescending on AsQueryable I receive the error message below.

When I use OrderBy the code executes perfectly. I stumbled onto this because I needed to pass an expression in my orderbyDescending and cannot do that on a list.

blazor.webassembly.js:1 Uncaught (in promise) Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.JSInterop.DotNetDispatcher.InvokeSynchronously (System.String assemblyName, System.String methodIdentifier, System.Object targetInstance, System.String argsJson) <0x1f50b28 + 0x001b8> in :0
at Microsoft.JSInterop.DotNetDispatcher.BeginInvoke (System.String callId, System.String assemblyName, System.String methodIdentifier, System.Int64 dotNetObjectId, System.String argsJson) <0x1f88730 + 0x00084> in :0
at Microsoft.JSInterop.DotNetDispatcher.InvokeSynchronously (System.String assemblyName, System.String methodIdentifier, System.Object targetInstance, System.String argsJson) <0x1f50b28 + 0x001b8> in :0
at Microsoft.JSInterop.DotNetDispatcher.BeginInvoke (System.String callId, System.String assemblyName, System.String methodIdentifier, System.Int64 dotNetObjectId, System.String argsJson) <0x1f88730 + 0x00084> in :0
at endInvokeDotNetFromJS (blazor.webassembly.js:1)
at Object.invokeJSFromDotNet (blazor.webassembly.js:1)
at _mono_wasm_invoke_js_marshalled (mono.js:1)
at wasm-function[1450]:935
at wasm-function[762]:25085
at wasm-function[762]:23853
at wasm-function[762]:23853
at wasm-function[762]:23853
at wasm-function[762]:24468
at wasm-function[762]:24468

My workaround for now is to perform a reverse on the List after the order by is called.

For example: AsQueryable().OrderBy(expression).ToList().Reverse().ToList()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment