Comments (9)
@paya-cz debugging on my local machine, I get an authorization code that looks like #######-####-####-####-############, also the code seems to be encoded as hex which looks very different from what you are showing in your example. Where did you get your authorization code from?
If you are still having trouble figuring out what is going on, could you get a fiddler trace of the sample application running as this will allow me to quickly diagnose the problem.
from livesdk-for-windows.
@peternied as mentioned in the comment line just above the code, the authorization code is just a garbage that I put in myself. Whole purpose of that was to see how the library handles errors - in this case, how it would handle garbage auth code. Getting a standard exception would be so much preferred rather than a deadlock or exception in Application.Run
. The code for handling this type of problems is already there, it just seems to not be implemented properly. In LiveAuthClientCore.cs
, it properly executes this.codeExchangeTask.SetException(authResult.Error);
in OnExchangeCodeCompleted
event handler (it sets LiveAuthException
in the SetException
), but for a reason that's beyond me, the ExchangeAuthCodeAsync
either fails in the end with a TargetInvocationException
or enters a deadlock.
from livesdk-for-windows.
Analyzing how the program works with a bad login code, we should execute a request that returns an error inside of LiveLoginResult via the LiveAuthRequestUtility's RequestAccessToken method. Inside of LiveAuthClientCore, the continuation is called, which in turn causes the OnExchangeCodeCompleted function to be called, setting the exception on the task instead of the result. Now that we are back on MainForm.cs inside of OnAuthCompleted, we should get the exception at the resolution of the await result, which then triggers the exception to be logged to the ApiExplorer output window. (This is at least what I'm seeing).
Now if you change the await into a .Result, you are now resolving the task which causes a slightly different exception to be thrown, specifically AggregateException. But if you look into the inner aggregate exception you'll find the same Microsoft.Live.LiveAuthException that would normally have been caught by the try block that call is inside of. The reason you get a TargetInvocationException is that is how WinForm exceptions bubble out of applications. You can verify this behavior for yourself by adding catch (Exception e) {this.LogOutput(e.ToString());} at the bottom of that method. I've pushed this branch which contains this change https://github.com/peternied/LiveSDK-for-Windows/tree/BadAuthToken
As far as I can tell by the application design, you should get an error in that output window, and it should help you understand what is going wrong, and I can't find a deadlock or blocking issue that would prevent the application from working.
from livesdk-for-windows.
You are right, I am getting the same behavior now. I guess I must have just messed up somewhere else.
However, it seems there is another problem (unless I am tripping again). If I set a valid refresh token in MainForm.cs:RetrieveRefreshTokenAsync
and I disconnect from the internet, then using the sample here on GitHub, I get NullReferenceException
in LiveAuthRequestUtility.ReadResponse
(invoked by RequestAccessToken
, invoked by LiveAuthClient.InitializeAsync
in MainForm_Load
). However if I replace the bundled Live library with the one from NuGet, I don't get any exceptions, but the method never progresses beyond await InitializeAsync
.
from livesdk-for-windows.
Hmm, not sure what is wrong there, as I don't seem to be able to repro your issue, if you could put up a repro on your personal fork I can give it a quick look.
from livesdk-for-windows.
Please take a look here https://github.com/paya-cz/LiveSDK-for-Windows/tree/exceptions
You will need your own refresh token for the 0000000048122D4E app. Be sure to disconnect from internet when you run the app.
from livesdk-for-windows.
Thanks! FYI - I'll take a look into this tomorrow.
from livesdk-for-windows.
Could you take a quick look and see if this resolves your problem? Btw thanks for the repro that helped a bunch narrow this issue down!
from livesdk-for-windows.
Thanks, it seems your commit fixed the issue. At least I haven't been able to find a way to break it again. :-) Cheers from Czech Republic!
from livesdk-for-windows.
Related Issues (20)
- Possibly null ref exception after remote tos update HOT 3
- Why LiveAuthRequestUtility.RefreshTokenAsync() is not public? HOT 1
- Background upload on Windows Phone RT does not report progress HOT 1
- Import email contact to websie HOT 3
- download / upload windows phone 8.1 HOT 4
- Nuget Package is out of date! HOT 1
- Nuget Package is still using custom IProgress<T> in .NET 4.5 HOT 1
- Subscribe calendar in windows phone HOT 4
- NullReferenceException at Microsoft.Live.ResourceHelper.GetString() HOT 1
- Server is always offline when moving non-existent file HOT 9
- Request throttling HOT 6
- UploadOperation is using unnecessary GetUploadLinkOperation HOT 2
- Server does not seem to be 100% consistent HOT 5
- WinStore: Crash at Microsoft.Live.ResourceHelper.GetString(String name) HOT 8
- WinStore resources file does not contain "NoResponseData" string
- Custom avatars cannot be loaded, the default one works fine HOT 2
- Live SDK package on Nuget doesn't work in Universal app and has to be installed manually HOT 5
- Will throw exception when used in a UWP compiled with .net native HOT 1
- Lack of login_hint param
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from livesdk-for-windows.