-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
Avoid NullReferenceException with async methods #66
Conversation
Moq should be .NET 3.5 compatible. |
I think I missed that information, since Since |
This is the script that builds .net35 and 40 of Moq. Conditional directives should be used to add .NET4.0+ features, and as long as you can run that script and get a valid Moq.nupkg output, we're good :) |
Sorry, I accidentally closed the Pull Request. @danielkzu, can you check if there is anything missing to merge this? |
Alex, I see a lot of files changed in the pull request that actually haven't changed. Looks like whitespace changes only. Could you clean that up so that the request includes only what actually changed? That would be substantially easier to review and merge. Thanks in advance and thanks for putting in the effort to fix this issue! |
Hey Daniel, these so called "whitespace changes" are actually intentional. You've created a while ago the file For anyone using Git in Windows, a lot of modified files will appear just after a clean clone. That happens because since the file has CRLF line-endings in the repo and you're telling Git to change all CRLF to LF, the diff shows only line-ending changes (which are impossible to get rid off, by the way) I've seen other contributors having trouble with that recently, so I think it is worth taking a look at. I tried to interactively rebase my work to remove the repository re-normalizing commit, but then I cannot apply my changes due to local changes. If you decide to do this fix directly to the master branch, I'll happily reapply my work on top of it. |
Good to know! Would you mind doing the forced re-normalization of the entire repo and Thanks! /kzu Daniel Cazzulino On Fri, Dec 13, 2013 at 9:10 AM, Alex Tercete [email protected]:
|
When using async methods and loose Mock Behavior, calls to Task methods give NullReferenceException, since default(Task) is null. Calls to Task.Wait() and Task<T>.Result should follow the loose behavior: do nothing and return the default value for T, respectively. Related to devlooped#64.
Use compile directives to ensure smooth NuGet package generation. 'IReturnsExtensions' was using 'System.Threading.Tasks' namespace, so compile directives were also added to it.
There you go, much cleaner indeed! ;) |
@@ -1,4 +1,5 @@ | |||
using System; | |||
#if !NET3x | |||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumb me. The entire file is not available on NET3x :)
Avoid NullReferenceException with async methods
Mmm... the build is broken for the Silverlight project: d:\temp\tmpE930\Source\EmptyDefaultValueProvider.cs(47,24): error As soon as the build is fixed, I'll ship this as 4.2. Did you try running build.bat on your end? /kzu Daniel Cazzulino On Fri, Dec 13, 2013 at 12:43 PM, Alex Tercete [email protected]:
|
I did run Are doing the fix or do you want me to do it instead? |
Swamped at the moment in other things. Could you take a look? Thanks! /kzu Daniel Cazzulino On Fri, Dec 13, 2013 at 1:07 PM, Alex Tercete [email protected]:
|
TPL presents in Silverlight 5. So, if Moq will provide separate SL4 and SL5 version or drop SL4 support, it can use auto async proxy creation for Silverlight. |
I'm happy to drop SL4 unless there is a massive outcry to keep it ;) /kzu from mobile
|
When using async methods and loose Mock Behavior, calls to
Task
methods giveNullReferenceException
, sincedefault(Task)
isnull
. Calls toTask.Wait()
andTask<T>.Result
should follow the loose behavior: do nothing and return the default value forT
, respectively.Related to #64.