-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
DateTime converted to Nullable<DateTime> inside optional navigation property, throws exception on AddDays #6261
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
Comments
@maumar we belive this is happening because the nav prop is rewritten and the type becomes nullable. |
Related to #5613 |
maumar
added a commit
that referenced
this issue
Aug 24, 2016
…c doesn't work for some cases involving multiple optional navs and method calls Problem was that we were providing null protection in case of optional navigation access, but that did not include further calling methods on top of them. If the navigation was null, the member access would return null and we would try to call a method on it, which results in NRE. Fix is to introduce a new reducible expression that represents conditional access to a method or a member. In memory this gets rewritten to a Block expression that recursively evaluates it's caller, assigns it to a variable and depending on the value, either returns null or performs the required access operation. This is superior to using Conditional expression that we did before, because the caller only gets evaluated once, rather than N times. Also fixes related issue #6261 - DateTime converted to Nullable<DateTime> inside optional navigation property, throws exception on AddDays.
maumar
added a commit
that referenced
this issue
Aug 24, 2016
…c doesn't work for some cases involving multiple optional navs and method calls Problem was that we were providing null protection in case of optional navigation access, but that did not include further calling methods on top of them. If the navigation was null, the member access would return null and we would try to call a method on it, which results in NRE. Fix is to introduce a new reducible expression that represents conditional access to a method or a member. In memory this gets rewritten to a Block expression that recursively evaluates it's caller, assigns it to a variable and depending on the value, either returns null or performs the required access operation. This is superior to using Conditional expression that we did before, because the caller only gets evaluated once, rather than N times. Also fixes related issue #6261 - DateTime converted to Nullable<DateTime> inside optional navigation property, throws exception on AddDays.
maumar
added a commit
that referenced
this issue
Aug 26, 2016
…c doesn't work for some cases involving multiple optional navs and method calls Problem was that we were providing null protection in case of optional navigation access, but that did not include further calling methods on top of them. If the navigation was null, the member access would return null and we would try to call a method on it, which results in NRE. Fix is to introduce a new reducible expression that represents conditional access to a method or a member. In memory this gets rewritten to a Block expression that recursively evaluates it's caller, assigns it to a variable and depending on the value, either returns null or performs the required access operation. This is superior to using Conditional expression that we did before, because the caller only gets evaluated once, rather than N times. Also fixes related issue #6261 - DateTime converted to Nullable<DateTime> inside optional navigation property, throws exception on AddDays. CR: Andrew
maumar
added a commit
that referenced
this issue
Aug 26, 2016
…c doesn't work for some cases involving multiple optional navs and method calls Problem was that we were providing null protection in case of optional navigation access, but that did not include further calling methods on top of them. If the navigation was null, the member access would return null and we would try to call a method on it, which results in NRE. Fix is to introduce a new reducible expression that represents conditional access to a method or a member. In memory this gets rewritten to a Block expression that recursively evaluates it's caller, assigns it to a variable and depending on the value, either returns null or performs the required access operation. This is superior to using Conditional expression that we did before, because the caller only gets evaluated once, rather than N times. Also fixes related issue #6261 - DateTime converted to Nullable<DateTime> inside optional navigation property, throws exception on AddDays. CR: Andrew
maumar
added a commit
that referenced
this issue
Aug 26, 2016
…c doesn't work for some cases involving multiple optional navs and method calls Problem was that we were providing null protection in case of optional navigation access, but that did not include further calling methods on top of them. If the navigation was null, the member access would return null and we would try to call a method on it, which results in NRE. Fix is to introduce a new reducible expression that represents conditional access to a method or a member. In memory this gets rewritten to a Block expression that recursively evaluates it's caller, assigns it to a variable and depending on the value, either returns null or performs the required access operation. This is superior to using Conditional expression that we did before, because the caller only gets evaluated once, rather than N times. Also fixes related issue #6261 - DateTime converted to Nullable<DateTime> inside optional navigation property, throws exception on AddDays. CR: Andrew
fixed in 7472a67 |
maumar
added
the
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
label
Aug 26, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
I believe this is a regression from RC1 or RC2 (I migrated from RC1 => RTM).
Trying to query all the orders completed within the last day:
(Note: Placement is the optional navigational property and, in the context of my solution, if it exists it indicates than the order has been placed)
Exception:
Message: Method 'System.DateTime AddDays(Double)' declared on type 'System.DateTime' cannot be called with instance of type 'System.Nullable`1[System.DateTime]'
Relevant classes (minimalized):
Workaround:
The text was updated successfully, but these errors were encountered: