Monogame, Xbox One, and the Creator's Program

I think I found the solution for the user creation crash:

https://social.msdn.microsoft.com/Forums/en-US/1c89e4c2-d0d9-4b51-90f9-e45e98a9b325/new-xboxliveuser-weird-exception?forum=xboxlivedev

follow step 4 :

1 Like

Hi Adman1974. Congratulations on your accomplishment
I have added a config file to my game and it no longer crashes. Thank you both

Can you please provide a sample of code that you used to see if the user is signed in, and if not, display the panel so they can choose a user to sign in with

Thanks Adman1974

The status I am getting is UserInteractionRequired

I have noticed I cannot sign into my xboxone sandbox despite adding it as a test account and updating the settings by clicking the Test button

I have emailed Microsoft for ideas, then I will try again

I will keep you posted

Thanks again

1 Like

Why is Adman1974ā€™s post flagged?

OK so I have tried a few different bits of code based on what has been kindly provided on this forum but I still cannot get the sign in to work. I have kept the following code very very simple to demonstrate the point it is breaking down

private async void GetUser()
{
SignInResult signInSilentlyTask;
SignInResult signInLoudlyTask;
user = new XboxLiveUser();
debug = ā€œā€;

        var dispatcher = Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher;
        signInSilentlyTask = await user.SignInSilentlyAsync(null);
        if (signInSilentlyTask.Status == SignInStatus.Success)
        {
            debug += "Worked ";
        }
        else
        {
            debug += signInSilentlyTask.Status.ToString();
        }
        if (signInSilentlyTask.Status == SignInStatus.UserInteractionRequired)
        {
            signInLoudlyTask = await user.SignInAsync(null); // **Error here**
            debug += signInLoudlyTask.Status.ToString();
        }
        debug += " exit";

}

When I try user.SignInAsync(null); or user.SignInAsync(dispatcher); I get an error
System.InvalidOperationException ā€˜Operation is not valid due to the current state of the objectā€™

System.InvalidOperationException occurred
HResult=0x80131509
Message=Operation is not valid due to the current state of the object.
Source=
StackTrace:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at CatStack.Game1.d__163.MoveNext() in C:\Users\xx\source\repos\CatStack\CatStack\Game1.cs:line 561

I have tried different combinations, null, dispatcher, two dispatcher objects, .CoreApplication.GetCurrentView() instead of .CoreApplication.MainView, try / catch statements. Nothing seems to work. I get the same error message

I am signed into my sandbox with a valid user. I can see my profile when I launch the game and press the XBox home button

But I cannot seem to be able to get the signed in user or force a sign in

Your help will be much appreciated

I think it could be a problem with the code running in a non-UI thread. Could you try this?

signInLoudlyTask = await user.SignInAsync(dispatcher);

1 Like

Hi KakCAT. Thanks for your reply

I had initially tried what you had posted before with no luck but I thought I would try again just to make sure

I discovered there was a subtle difference in the error message I was getting (Iā€™m not sure why it didnā€™t appear yesterday):
The application requesting authentication tokens is either disabled or incorrectly configured

The solution was to right click the game --> Store --> Associate App with Store

I think the reason why I got this error is because I generated my config file from Unity so it has about 8 lines in it (instead of the 3 you sent to me) - including links to the ids I created. The reason I generated it from unity is because I wanted to look at the backend files while trying to work out how to get the sign in working

I am going to try working with a leaderboard now and then trying to get a game published (it is a simple game). If successful I will document a start to end process (along with mistakes I made along the way) and post it in a blog for use with this forum

Thanks to everyone for your help

Thanks for the followup! This is super confusing stuff, and the Internet Gods smile on those who fix their own problems and post their solutions for others to see!

I donā€™t want to be all ā€œI told you so!ā€, but just for future codersā€¦ there are some hoops you need to jump through before your stuff starts working. And youā€™ll get weird esoteric errors if your app is not recognized by Microsoft.

Good luck with leaderboards! Please do document and share your problems and solutions!

1 year later Iā€™ve found a proper way to discover the reasons why Xbox live DLL hard crashes without apparent reason.

If you set up your project properties -> Debug to debugger type Mixed (Managed and Native) you get a very descriptive error in the Debug Output when the crash happens. For some reason that message does not appear without native debugging.

So finally I found a bug (only happenning when debugging) of my game randomly crashing: It was a Xbox Live throttling message.

I know itā€™s an old thread, but it will surely help somebody if heā€™s running into the hard crashes ( C# coders sure are not used to get those :slight_smile: )