Skip to content
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

Error with Microsoft.Graph #7

Closed
mpp opened this issue Mar 24, 2020 · 5 comments · Fixed by #9
Closed

Error with Microsoft.Graph #7

mpp opened this issue Mar 24, 2020 · 5 comments · Fixed by #9

Comments

@mpp
Copy link

mpp commented Mar 24, 2020

Hi, I'm trying to use Fluxor in combination with an API I wrote and Microsoft.Graph.

I'm getting this exception in the console:

WASM: Fluxor.Exceptions.StoreInitializationException: Store initialization error ---> System.NotSupportedException: The collection type 'Microsoft.Graph.IUserOwnedDevicesCollectionWithReferencesPage' on 'Microsoft.Graph.User.OwnedDevices' is not supported.
p.printErr @ blazor.webassembly.js:1

I need to get the members of an Azure AD Group and perform some operations on them.
Do you know if I need to set any parameter in order to be able to work with the Microsoft.Graph 3.0.1 nuget package?

@mrpmorris
Copy link
Owner

What is the rest of the callstack?

@mpp
Copy link
Author

mpp commented Mar 24, 2020

blazor.webassembly.js:1 WASM: Unhandled exception rendering component:
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM: Fluxor.Exceptions.StoreInitializationException: Store initialization error ---> System.NotSupportedException: The collection type 'Microsoft.Graph.IUserOwnedDevicesCollectionWithReferencesPage' on 'Microsoft.Graph.User.OwnedDevices' is not supported.
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonClassInfo.GetElementType (System.Type propertyType, System.Type parentType, System.Reflection.MemberInfo memberInfo, System.Text.Json.JsonSerializerOptions options) <0x356a580 + 0x0015a> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonClassInfo.CreateProperty (System.Type declaredPropertyType, System.Type runtimePropertyType, System.Type implementedPropertyType, System.Reflection.PropertyInfo propertyInfo, System.Type parentClassType, System.Text.Json.Serialization.JsonConverter converter, System.Text.Json.JsonSerializerOptions options) <0x3566820 + 0x0029a> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonClassInfo.AddProperty (System.Type propertyType, System.Reflection.PropertyInfo propertyInfo, System.Type classType, System.Text.Json.JsonSerializerOptions options) <0x355d960 + 0x00072> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonClassInfo..ctor (System.Type type, System.Text.Json.JsonSerializerOptions options) <0x3552278 + 0x00168> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonSerializerOptions.GetOrAddClass (System.Type classType) <0x35442c0 + 0x00036> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonPropertyInfo.get_ElementClassInfo () <0x362d400 + 0x0002a> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonSerializer.HandleObject (System.Text.Json.JsonPropertyInfo jsonPropertyInfo, System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonWriter writer, System.Text.Json.WriteStack& state) <0x3818be8 + 0x000d2> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonSerializer.WriteObject (System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonWriter writer, System.Text.Json.WriteStack& state) <0x3818858 + 0x000cc> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonSerializer.Write (System.Text.Json.Utf8JsonWriter writer, System.Int32 originalWriterDepth, System.Int32 flushThreshold, System.Text.Json.JsonSerializerOptions options, System.Text.Json.WriteStack& state) <0x3582d50 + 0x000ec> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonSerializer.WriteCore (System.Text.Json.Utf8JsonWriter writer, System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x33417f0 + 0x0008a> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonSerializer.WriteCore (System.Text.Json.PooledByteBufferWriter output, System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x3340e60 + 0x00040> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonSerializer.WriteCoreString (System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x3340a68 + 0x0003c> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at System.Text.Json.JsonSerializer.Serialize[TValue] (TValue value, System.Text.Json.JsonSerializerOptions options) <0x33406d0 + 0x0000c> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue] (System.String identifier, System.Threading.CancellationToken cancellationToken, System.Object[] args) <0x37e7fe0 + 0x001f6> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue] (System.String identifier, System.Object[] args) <0x37e7878 + 0x0005a> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop.InvokeFluxorDevToolsMethodAsync[TResult] (System.String identifier, System.Object[] args) <0x3a80008 + 0x0005c> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsInterop.InitializeAsync (System.Collections.Generic.IDictionary`2[TKey,TValue] state) <0x3a7fd58 + 0x00056> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Fluxor.Blazor.Web.ReduxDevTools.ReduxDevToolsMiddleware.InitializeAsync (Fluxor.IStore store) <0x3a742d8 + 0x000e0> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Fluxor.Store.InitializeMiddlewaresAsync () <0x3a73a70 + 0x00100> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Fluxor.Store.ActivateStoreAsync () <0x3a6e240 + 0x000d4> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Fluxor.Store.InitializeAsync () <0x3a6dc48 + 0x000d4> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Fluxor.Blazor.Web.StoreInitializer.OnAfterRenderAsync (System.Boolean firstRender) <0x3a27950 + 0x00272> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:    --- End of inner exception stack trace ---
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Fluxor.Blazor.Web.StoreInitializer.OnAfterRenderAsync (System.Boolean firstRender) <0x3a27950 + 0x002ac> in <filename unknown>:0 
p.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x393b420 + 0x000c2> in <filename unknown>:0 

This is the whole console output.
To reproduce it I did the following:

Added the package reference

<PackageReference Include="Microsoft.Graph" Version="3.0.1" />

Created my state class as:

    public class FooMembersState
    {
        public bool IsLoading { get; private set; }
        public string ErrorMessage { get; private set; }
        public IEnumerable<Microsoft.Graph.User> FooMembers { get; private set; }

        public FooMembersState(
            bool isLoading,
            string errorMessage, 
            IEnumerable<Microsoft.Graph.User> fooMembers)
        {
            IsLoading = isLoading;
            ErrorMessage = errorMessage;
            FooMembers = fooMembers;
        }
    }

@mrpmorris
Copy link
Owner

Thanks for the additional information. I was able to reproduce this and fix it. Could you try this prerelease and let me know if it solves the problem for you?

https://www.nuget.org/packages/Fluxor.Blazor.Web.ReduxDevTools/3.1.0-Pre-1

@mpp
Copy link
Author

mpp commented Mar 24, 2020

It's working, I'm not getting the users yet but it's just an authorization/permissions problem now.

Thank you very much!

@mrpmorris
Copy link
Owner

It was the fault of System.Text.Json, I changed the interop so it always passes strings encoded with Newtonsoft and then JSON parses it in JS.

It'll be slower, but the ReduxDevTools are really only for debug so I can live with that :)

@mrpmorris mrpmorris mentioned this issue Apr 17, 2020
mrpmorris added a commit that referenced this issue Apr 17, 2020
* Use Newtonsoft for serialization (Fixes #7)

* FluxorLayout (Fixes #8)

* Update subscription tests

* FluxorLayout tests

* Update release docs
@mrpmorris mrpmorris linked a pull request May 6, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants