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

Adding a .NET 8 target follow up for extensions packages #47214

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,13 @@ private static IReadOnlyDictionary<string, Type> GetBindingDataContract(Paramete
public async Task<ITriggerData> BindAsync(object value, ValueBindingContext context)
{
var request = (HttpRequestMessage)value;
#if NET8_0_OR_GREATER
m-redding marked this conversation as resolved.
Show resolved Hide resolved
HttpRequestOptionsKey<WebJobsAuthenticationEventResponseHandler> httpRequestOptionsKey = new(WebJobsAuthenticationEventResponseHandler.EventResponseProperty);
request.Options.TryGetValue(httpRequestOptionsKey, out WebJobsAuthenticationEventResponseHandler eventResponseHandler);
#else
WebJobsAuthenticationEventResponseHandler eventResponseHandler =
(WebJobsAuthenticationEventResponseHandler)request.Properties[WebJobsAuthenticationEventResponseHandler.EventResponseProperty];
#endif
try
{
if (request == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ public async Task<HttpResponseMessage> ConvertAsync(HttpRequestMessage input, Ca
//We create an event response handler and attach it to the income HTTP message, then on the trigger we set the function response
//in the event response handler and after the executor calls the functions we have reference to the function response.
WebJobsAuthenticationEventResponseHandler eventsResponseHandler = new WebJobsAuthenticationEventResponseHandler();
#if NET8_0_OR_GREATER
HttpRequestOptionsKey<WebJobsAuthenticationEventResponseHandler> httpRequestOptionsKey = new(WebJobsAuthenticationEventResponseHandler.EventResponseProperty);
input.Options.Set(httpRequestOptionsKey, eventsResponseHandler);
#else
input.Properties.Add(WebJobsAuthenticationEventResponseHandler.EventResponseProperty, eventsResponseHandler);
#endif

TriggeredFunctionData triggerData = new TriggeredFunctionData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,16 @@ public async Task<FunctionResult> ExecuteAsync(QueueMessage value, CancellationT
// Include the queue details here.
IDictionary<string, string> details = PopulateTriggerDetails(value);

#pragma warning disable CS8073 // The result of the expression is always true in net8.0, but not this is not true in netstandard2.0
if (blobProperties.CreatedOn != null)
#pragma warning restore CS8073
{
details[BlobCreatedKey] = blobProperties.CreatedOn.ToString(Constants.DateTimeFormatString, CultureInfo.InvariantCulture);
}

#pragma warning disable CS8073 // The result of the expression is always true in net8.0, but not this is not true in netstandard2.0
if (blobProperties.LastModified != null)
#pragma warning restore CS8073
{
details[BlobLastModifiedKey] = blobProperties.LastModified.ToString(Constants.DateTimeFormatString, CultureInfo.InvariantCulture);
}
Expand Down
Loading