text:
Your First ASP.NET Core Web App Using Visual Studio

Create new MVC Core app with individual user accounts.
require SSL
Push to Azure - demo SSL and user account works with DB

It should live here where the old one used to: https://docs.asp.net/en/latest/tutorials/your-first-aspnet-application.html

@danroth27 @tdykstra @sayedihashimi  For a simple deploy to azure tutorial, what's the preferred way to deploy? From project creation should I select "Host in the cloud"?
That doesn't seem to let you create a new resource group.
Publishing after also doesn't let me create a new RG.

@danroth27 @tdykstra @sayedihashimi
Looks like my Azure SDK is outdated, that's why I can't create a new RG. I'll following https://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-get-started/ but deploy a ASP.NET MVC Core app
@danroth27 see my updated outline at the top

My preference is to use the default template with no additional configuration. Why disable authentication? Are there issues with the publishing experience when identity and EF are involved?

@danroth27 Adding the EF/SQL greatly complicated publishing for what I feel is very little value. It takes far longer to provision and publish with a high probability of a publish error.
I'm fine with publishing with authen/db.

To publish just create a publish profile, no need to go through Host in the Cloud.

https://github.com/aspnet/Docs/pull/1266

authors: Rick-Anderson danroth27 sayedihashimi

repo: aspnet/Docs


text:
Minor readability improvement

Typo: ..note should have been ".. note:: " to appear correctly in rendered text.

Thanks!

source: gharchive/pull-request

authors: ardalis vkichline

license_type: permissive

license_source: github-api


text:
RevEng: Self referencing relationships only partially specified in generated code

CREATE TABLE [dbo].[Category](
	[CategoryId] [int] IDENTITY(1,1) NOT NULL,
	[DisplayName] [nvarchar](max) NULL,
	[ParentCategoryId] [int] NULL,
 CONSTRAINT [PK_Category] PRIMARY KEY NONCLUSTERED
(
	[CategoryId] ASC
))

GO

ALTER TABLE [dbo].[Category]  WITH CHECK ADD  CONSTRAINT [FK_Category_Category_ParentCategoryId] FOREIGN KEY([ParentCategoryId])
REFERENCES [dbo].[Category] ([CategoryId])
GO

The collection navigation and foreign key properties are not generated on the class.
    public partial class Category
    {
        public Category()
        {
            Product = new HashSet<Product>();
        }

        // Properties
        public int CategoryId { get; set; }
        public string DisplayName { get; set; }

        // Navigation Properties
        public virtual Category ParentCategory { get; set; }
    }
}

And there is no call to .InverseCollection(...) in the relationship config.
            modelBuilder.Entity<Category>(entity =>
                {
                    entity.Reference<Category>(d => d.ParentCategory);
                }
            );

Fixed with commit 2db815c.

source: gharchive/issue

authors: lajones rowanmiller

repo: aspnet/EntityFramework

license: MIT


text:
"ArgumentNullException: Value cannot be null. Parameter name: provider" error occurs when accessing certain navigation properties after Skip()

Minimal repro steps
Create these two entities.
public class Property
{
    public int Id { get; set; }

    [Required]
    public int EmployeeId { get; set; }
    public Employee Employee { get; set; }
}
public class Employee
{
    public int Id { get; set; }

    [StringLength(256)]
    public string FirstName { get; set; }
}

This will work:
var testNav = await AppContext.Properties
    .Select(p => p.Employee.FirstName)
    .ToListAsync();

But this will not work (see exception below):
var testNav = await AppContext.Properties
    .Skip(20)
    .Select(p => p.Employee.FirstName)
    .ToListAsync();

You can select the p.Employee.Id after the skip, but not p.Employee.FirstName. Both work without the skip.
Expected result
You should be able to use .Select() after .Skip() and access navigation properties. It works fine in EF6 (although EF6 requires an OrderBy before the Skip). Using OrderBy before skip does not fix the issue in EF7.
Actual result
System.ArgumentNullException: Value cannot be null.
Parameter name: provider
    at Microsoft.Data.Entity.Utilities.Check.NotNull[T](T value, String parameterName)
    at Microsoft.Data.Entity.Query.Internal.EntityQueryable`1..ctor(IAsyncQueryProvider provider)
    at Microsoft.Data.Entity.Query.ExpressionVisitors.Internal.NavigationRewritingExpressionVisitor._CreateEntityQueryable[TResult](IAsyncQueryProvider entityQueryProvider)

Same issue as #3962
Addressed in #4128


text:
Eager Load Results In Null Collection If No Items Present

Given a setup like this:
public class SomeItem
{
	public Guid Id { get; set; }

	public ICollection<OtherThing> OtherThings { get; set; }

	protected override void OnModelCreating(EntityTypeBuilder<SomeItem> entity)
	{
	}
}

public class OtherThing
{
	public Guid Id { get; set; }

	public Guid SomeItemId { get; set; }

	public SomeItem SomeItem { get; set; }

	protected override void OnModelCreating(EntityTypeBuilder<OtherThing> entity)
	{
		entity.HasOne(e => e.SomeItem).WithMany(e => e.OtherThings).HasForeignKey(e => e.SomeItemId);
	}
}

public void QueryItems()
{
	var item = dbContext.SomeItems.Include(s => s.OtherThings).FirstOrDefault(); // Returns an item for sake of example
	item.OtherThings // this is null instead of empty collection.
}

We see a collection being null when it should be an empty collection from what I can gather.
Am I missing something or is this a bug?
Workaround is to initialize the ICollection in the constructor, but it seems like I shouldn't have to.

@StrangeWill I am not able to reproduce this. Which version of EF Core are you using?

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.

authors: StrangeWill ajcvickers


text:
Remove Compiled Model prototype

Removing the compiled model code so we don't need to maintain it (for #1896)
@divega @ajcvickers @AndriySvyryd

:shipit:

authors: anpete mikary


text:
Fix to #2274 - Chaining multiple Include with ThenInclude throws Sysem.InvalidOperationException

Problem is that for complex queries with multiple includes we were attempting to materialize entities based on incorrect readers. Basically the way it works is that when we process include we build a factories that produce entities from actively opened readers.
Those were being build in isolation, starting fresh for each IncludeSpecification. Problem is that multiple include chains can leave readers open, that the other include chain was not aware of. This would produce errors like NRE, index outside bounds, invalid cast etc, when attempting to access incorrect reader while materializing entities.
Fix is to correctly compute indeces (which reader should be accessed for each entity) that each include chain needs to access. Computation is being done in the reverse order because this is the order that readers will eventually be executed in. Also we only compute indeces for Reference includes - Collections don't need them as they always open a new reader.

@anpete

:shipit:

authors: anpete maumar


text:
Propagate type mapping from principal property to dependent property

So that if the type mapping for a primary key is changed, then the type mapping for referencing foreign keys will also change.
Issue #2455

:shipit:

authors: AndriySvyryd ajcvickers


text:
Configuration.GetSection destroys Configuration["YYY"]

I have a web application with a startup.cs that looks something like this:
public Startup(IHostingEnvironment env)
    {
      var builder = new Microsoft.Extensions.Configuration.ConfigurationBuilder()
          .SetBasePath(env.ContentRootPath)
          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
          .AddEnvironmentVariables();

      if (env.IsDevelopment())
      {
        // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
        builder.AddApplicationInsightsSettings(developerMode: true);
      }

      var config = builder.Build();

      // Add key vault configuration if not in local development mode
      if (!env.IsDevelopment())
      {
        builder.AddAzureKeyVault($"https://{config["KeyVault:Vault"]}.vault.azure.net/", config["KeyVault:ClientId"], config["KeyVault:ClientSecret"]);
      }

      Configuration = builder.Build();
    }

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
    {

      loggerFactory.AddConsole(Configuration.GetSection("Logging"));
      loggerFactory.AddDebug();

      app.UseCors(policy =>
      {
        policy.WithOrigins(Configuration["AppSettings:CorsOrigins"]);
        policy.AllowAnyHeader();
        policy.AllowAnyMethod();
        policy.WithExposedHeaders("WWW-Authenticate");
      });
}

After publishing it to Azure, and restarting the site I noticed that Cors origins was not set correctly.
I added a IConfiguration to one of my MVC Controls and returned the value of Configuration["AppSettings:CorsOrigins"]. The value looked fine but CORS wasn't working.
I decided to hard code the domain in the WithOrigins option and publish again. Now everything was working fine. After removing the hard coded values and restore my configuration it stoped working again.
I decided to exclude any code that might interfere with the Configuration object and when I removed:
     loggerFactory.AddConsole(Configuration.GetSection("Logging"));
      loggerFactory.AddDebug();

everything started to work again. Somehow, Configuration.GetSection or the loggerFactory does something to the Configuration so it doesn't work as expected afterwards. But using IConfiguration later in a controller seems to work.
Am I missing something here or is this a bug?
(VS 2017 latest Tooling, .Net Core 1.1.0)

This issue was moved to aspnet/Configuration#592

authors: Eneuman Tratcher

repo: aspnet/Home


text:
consider removing default in memory key managment

From @danielDevelops on Thursday, September 28, 2017 11:29:28 AM
Since the default new project doesn't indicate that this needs to be configured, it would be nice to not have this partially work.  When running core on IIS it defaults to in-memory key management and that isn't apparent when users are randomly getting logged out when the app pool restarts.
Copied from original issue: aspnet/DataProtection#277

From @blowdart on Friday, October 13, 2017 12:00:45 PM
@muratg @Eilon @GrabYourPitchforks
We've talked about this before with @DamianEdwards and @davidfowl about just halting if ephemeral is selected by default, rather than by an explicit gesture. We should revisit this.

From @GrabYourPitchforks on Friday, October 13, 2017 6:23:20 PM
The decision to fall back to the ephemeral keyring by default was originally intended to make development scenarios "just work", as it would push people away if we forced them to deal with key storage and management while they were just starting out. If there's some way of distinguishing between development and production environments you could change the fallback logic to account for that.

From @danielDevelops on Friday, October 13, 2017 7:09:52 PM
For me, I would rather not have any default and just have the ephemeral keyring as pre-configured in the MVC template.


text:
Default IDistributedCache for session

I call services.AddSession() in the Configure section of my Startup file. I am able to store and retrieve data even without adding a distributed cache. Does AddSession() do this automatically?

No, but MVC does.
https://github.com/aspnet/Mvc/blob/8e323a8e1e78b520e9a1c2a5a5f64139d5c210d0/src/Microsoft.AspNetCore.Mvc.TagHelpers/DependencyInjection/TagHelperExtensions.cs#L34
Note this is only a local fallback, not a real distributed cache.

Could the docs be updated to include this information?

Right, this is "sort of" an implementation detail. MVC just does what it needs to do to make things work out of the box.
For the reason @Tratcher mentioned, this isn't exactly something we would document because it's something that could easily change in the future and shouldn't be relied on in terms of details.

authors: Eilon Tratcher shravan2x


text:
Need a better error message when kestrel cannot get the requested port

#This is what I see when Kestrel cannot get the port I asked for. This is on .NET Core 2.1 RC1 (with a 2.0 app).
pi@raspberrypi:~/dotnet-docker/samples/aspnetapp/aspnetapp $ export ASPNETCORE_URLS=http://+:80
pi@raspberrypi:~/dotnet-docker/samples/aspnetapp/aspnetapp $ dotnet run
crit: Microsoft.AspNetCore.Server.Kestrel[0]
      Unable to start Kestrel.
Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.UvException: Error -13 EACCES permission denied
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.LibuvFunctions.ThrowError(Int32 statusCode)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.LibuvFunctions.ThrowIfErrored(Int32 statusCode)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.LibuvFunctions.tcp_bind(UvTcpHandle handle, SockAddr

@halter73
Have you tried a 2.1 app?

Same error message in 2.1.201
System.AggregateException: One or more errors occurred. (Error -4092 EACCES permission denied) ---> Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.UvException: Error -4092 EACCES permission denied
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.LibuvFunctions.ThrowError(Int32 statusCode)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.UvTcpHandle.Bind(IPEndPoint endPoint)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Listener.ListenTcp(Boolean useFileHandle)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Listener.<>c.<StartAsync>b__8_0(Listener listener)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.LibuvThread.DoPostWork()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.ListenerPrimary.<StartAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.LibuvTransport.<BindAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.LibuvTransport.<BindAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__DisplayClass23_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindEndpointAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindAddressAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.<BindAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<StartAsync>d__23`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
   at Microsoft.ServiceFabric.Services.Communication.AspNetCore.AspNetCoreCommunicationListener.OpenAsync(CancellationToken cancellationToken)
   at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.<OpenCommunicationListenersAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.<System-Fabric-IStatelessServiceInstance-OpenAsync>d__13.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
---> (Inner Exception #0) Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.UvException: Error -4092 EACCES permission denied
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.LibuvFunctions.ThrowError(Int32 statusCode)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.UvTcpHandle.Bind(IPEndPoint endPoint)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Listener.ListenTcp(Boolean useFileHandle)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Listener.<>c.<StartAsync>b__8_0(Listener listener)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.LibuvThread.DoPostWork()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.ListenerPrimary.<StartAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.LibuvTransport.<BindAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.LibuvTransport.<BindAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__DisplayClass23_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindEndpointAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindAddressAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.<BindAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<StartAsync>d__23`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
   at Microsoft.ServiceFabric.Services.Communication.AspNetCore.AspNetCoreCommunicationListener.OpenAsync(CancellationToken cancellationToken)
   at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.<OpenCommunicationListenersAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.<System-Fabric-IStatelessServiceInstance-OpenAsync>d__13.MoveNext()<---

2.1.201

@abatishchev the error is different in 2.1, it doesn't look like you're using it. Type dotnet --info, it'll tell you what version of the runtime and SDK you are using. 2.1.201 is the SDK version not the runtime version.

@davidfowl indeed.
.NET Command Line Tools (2.1.201)

Product Information:
 Version:            2.1.201
 Commit SHA-1 hash:  7932dc6179

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.201\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.7
  Build    : 2d61d0b043915bc948ebf98836fefe9ba942be11

authors: Tratcher abatishchev davidfowl richlander


text:
Convert 'StatusCodes' class to 'StatusCode' enumeration

@Tratcher I notice from your PR #182 that StatusCodes are class the contains a constants, i think it will be nice to convert it to enumeration while all the values represents HttpStatusCode

No, we decided not to use an existing enum (System.Net.HttpStatusCode).  HTTP status codes are a poor fit for enums. It's an open set of information, not a finite set. There are also some duplicate values possible.

How it possible to have some duplicate values, while it represent Http status codes?!!

@hishamco why does it need to be an enum?

See https://msdn.microsoft.com/en-us/library/system.net.httpstatuscode(v=vs.110).aspx and look for 301 and 302 which each have two definitions.

@davidfowl while all the constants in StatusCodes represent an Http status code, so enumeration is suitable type in CLR to represent such values and why enum is.

@Tratcher according to the RFC here http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html, each code represents only one value, I'm not sure why there are in System.Net.HttpStatusCode?!!

If you have a look in our new APIs here https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNet.Http.Abstractions/StatusCodes.cs#L17 301 Moved no longer exist while 301 MovedPermanently there

Your ignoring the part about open vs closed sets. Http stays codes can be anything from 100 to 599 (?). While the rfc species a few it allows for more to be added. It also allows for non-standard codes to be used. Enums work for complete sets of data, but they do not work well for incomplete sets like this where users would have to cast to fill in the gaps.

I didn't ignore the open vs close sets :smile: I'm with you @Tratcher that enum is suitable for closed set, nothing but I saw several implementation such as .NET, Java .. etc that used Http status codes as enumeration ..

They're still available as an enum from System.Net - you just have to cast to int to use them. And that's why we created a new one. Also, I think everyone here agrees the names of the new type are better than the existing enum because they include both the status code number and the short name.

@Eilon i'm still thinking why you didn't use the existing enum while you can get the status names and codes too, but if we agreed about the current type I have another two suggestion, first of all singular name may better than plural StatusCode have a look to my PR here https://github.com/aspnet/Hosting/pull/275/files, second thing it will be nice if we modify the class to something like
public static class StatusCode
{
        public const int OK = 200;
        public const int Created = 201;
        public const int Accepted = 202;
        public const int NonAuthoritative = 203;
        public const int NoContent = 204;
        public const int ResetContent = 205;
        public const int PartialContent = 206;
        ...
}

because the dev he/she knows that he using StatusCode

We want a type that has values that describe both the status code description and its numeric value. There is no existing type that does this.

I see .. thanks for clarification @Eilon

I still think the smurf naming is a bit too much though... StatusCodes.Status200OK? It wouldn't hurt to leave out the some StatusStatus? :wink:

@khellang do you have a suggestion for that? Identifiers can't start with integers unfortunately. And we don't like StatusCodes.OK200 either because we feel having the number come first is more usable.

Ouch. Forgot about that... Well, then I guess you're out of options :disappointed:

BTW, have you thought about a using an implicitly convertible type, simply wrapping the int (why not a short?) for discoverability of the constants?

Not sure what you mean by that - can you show an example?

Consider this:
[DebuggerDisplay("{ToString(), nq}")]
public partial struct HttpStatusCode : IEquatable<HttpStatusCode>
{
    public HttpStatusCode(int value)
    {
        Value = value;
    }

    public int Value { get; }

    public bool Equals(HttpStatusCode other) => Value.Equals(other.Value);

    public override bool Equals(object obj) => !ReferenceEquals(null, obj) && (obj is HttpStatusCode && Equals((HttpStatusCode) obj));

    public override int GetHashCode() => Value;

    public override string ToString() => Value.ToString();

    public static bool operator ==(HttpStatusCode left, HttpStatusCode right) => left.Equals(right);

    public static bool operator !=(HttpStatusCode left, HttpStatusCode right) => !left.Equals(right);

    public static implicit operator HttpStatusCode(int value) => new HttpStatusCode(value);

    public static explicit operator int(HttpStatusCode statusCode) => statusCode.Value;
}

public partial struct HttpStatusCode
{
    public static readonly HttpStatusCode Status200OK = 200;
    public static readonly HttpStatusCode Status201Created = 201;
    public static readonly HttpStatusCode Status202Accepted = 202;
    public static readonly HttpStatusCode Status203NonAuthoritative = 203;
    public static readonly HttpStatusCode Status204NoContent = 204;
    public static readonly HttpStatusCode Status205ResetContent = 205;
    public static readonly HttpStatusCode Status206PartialContent = 206;

    // -- Snipped for brevity
}

If the public APIs exposed HttpStatusCode instead of int, it would be easier to see which type to find the different status codes on.

I like that. :smile: Although the amount of code for such a simple type is a bit much, but that might not be a big issue.

BTW, here's a quick Twitter poll :wink: https://twitter.com/khellang/status/632105286870896640

Although the amount of code for such a simple type is a bit much, but that might not be a big issue.

Yeah, blame C# for that. http://fsharpforfunandprofit.com/posts/fsharp-decompiled/ :stuck_out_tongue_winking_eye:

Not really clear why you would "want a type that has values that describe both the status code description and its numeric value".
Some prefer the numbers, some prefer the name, but including both (perhaps this is the "compromise" position?) is sufficiently ugly and verbose to put people off. I really don't sign up to "everyone here agrees the names of the new type are better than the existing enum because they include both the status code number and the short name"
There is a learning curve here, and either those who prefer the number will have to climb it, or other who prefer then name will have to deal with it. Personally I favour using the name only in the constant/enum, with option to cast from int if that's your preference,

In Simple.Web (which is discontinued because MVC 6 is so much like it) I used a struct with implicit casting as in @khellang's example: https://github.com/markrendle/Simple.Web/blob/master/src/Simple.Web/Status.cs
It includes methods for any status which includes a Location header, e.g. Status.Created(resourceUrl).
I don't like the Status200OK format for names, not least because it's not IntelliSense-friendly. If people want to use numbers, they can just use an int.

So the use of an int to represent an int is a "primitive obsession?"
I've seen this term "primitive obsession" pop up more and more... always used as as pejorative, casting the use of a simple type to represent a simple value as too simplistic.
Here's a story:

Bob:  Frank, why are you using string a string for the user's name?
Frank: Because that's what the user entered, they just typed their name in the box and...
Bob:  No!!! What is your obsession with using data this way, you're always like this!  A better solution is this Name class I built, it'll give you so much more, look here...

And here's the topper:

Frank: Although the amount of code for such a simple type is a bit much, but that might not be a big issue.
Bob:  Yeah, blame C# for that. Maybe we should consider switching to F# while we're at it?

Yeah, blame the language for forcing us to write all this boilerplate code... to wrap the simplest of values in a big abstraction of my own design!
If there's an obsession here, it's one in which programmers feel they must model everything with code.  Just stop and look, as we're going from
statusCode == 200

to
statusCode == Microsoft.AspNet.Http.StatusCodes.Status200OK

to now
public static bool IsOk(this MySuperiorStatusCode statusCode)
{
    return statusCode.Value == HttpStatusCode.Status200Ok;
}

var mySuperiorStatusCode = new MySuperiorStatusCode(statusCode);
mySuperiorStatusCode.IsOk()

Look how simple that is to represent the "ok?"
For the record, I like the thinking of the @hishamco's call to swap Status200OK to OK.  Look, we're adults writing code dealing with status codes.  Leave it to our unit tests to deal with status code 200 as an input to our application, and let's make our production code as simple to read and write as possible.  OK beats Status200OK for that.

For the record; nothing in your example is true, even with the type suggested, you can still do statusCode == 200. All the other stuff is just hyperbolic bullshit :smile:

So the use of an int to represent an int is a "primitive obsession?"

You're not representing an int, you're representing a HTTP status code.

We still feel the current design and API names are a good balance of usability and flexibility.
In my view a problem with introducing types (e.g. the struct) is that it ends up not being clear that you can use just an int because implicit operators are not very obvious.
There's no "silver bullet" here, obviously, but in our view the current approach has the greatest value and the fewest downsides.

You really feel that outweighs the benefits of a separate type? You don't even need to use an int, you can use the static values. And once you need/want to use an int, you learn that you can use it by reading docs or a simple google search, and have nice IntelliSense forever. I'm not sure "implicit operators are not very obvious" is what you should worry about.

The current design makes the consts entirely optional. People are free to use the consts, existing enums (just have to cast to int), or a new type such as the one you propose.

Backreference: https://github.com/aspnet/HttpAbstractions/issues/174

authors: AnthonySteele Eilon Tratcher darrencauthon davidfowl henkmollema hishamco khellang markrendle

repo: aspnet/HttpAbstractions


text:
EF6 support… somehow?

I've come to realize over the last few months of working with it that EF7, while a spectacular and welcome break from the older versions, is not going to be ready for many types of serious production work by the time that the rest of ASPNET5 is release-quality.  The team has made it pretty clear that the 1.0 release of EF7 will be missing a lot of functionality.
This has me in a bit of a bind with regards to the Identity framework, because as far as I've been able to tell, it's really the only portion of ASPNET5 that, effectively, is tightly bound to EF7, or at least not compatible with EF6.
Tightly bound, you ask?  The EF7-specific portions of it are in a completely separate assembly, right?  Yes, this is true.  The problem with this is absolutely not the fault of the Identity framework, but with EF6:
It is impossible to create or use EF6 migrations within an ASPNET5-style project.  For most cases, there's a work-around for this: you create your create a "classic" style project that contains your DbContext, create and use your migrations on that, and then use the "kpm wrap" command to create a project wrapper that can be referenced from aspnet5 projects.
So, what's the problem, then?
Well, "classic" style projects can't reference the Microsoft.AspNet.Identity package because it relies on the aspnet5 or aspnet5core runtime.  Therefore it's not possible to create a DbContext that references IdentityUser, IdentityRole, etc, etc.
I can see that IdentityUser et all are really just utility classes and aren't strictly necessary to an implementation of IUserStore, IUserRoleStore, etc, etc, but it's also a huge waste to have to completely re-implement all the functionality those classes implement in order to build a functioning identity store in EF6.
So, one idea:
Move everything in the Identity assembly that has no external dependencies into a separate assembly that can be referenced from a classic .net project.  This would make it very simple to implement an identity store in EF6.
Any ideas or thoughts about this?  Has anyone successfully gotten this working with EF6 yet? Do you foresee any problems with creating another assembly containing the interfaces and POCOs that are useful in creating the Stores?

Okay, I notice you've just done sorta the opposite of what I was requesting:
You moved all of the POCOs directly into the EntityFramework project instead of a 3rd project.
I guess this would make it slightly cleaner for me to make a direct port of Identity.EntityFramework to EF6 (since there would not be duplicate types in Identity) but doesn't really save any effort.

Okay, so I managed to port the EF identity store provider to EF6 without too much trouble.  The biggest problem was that EF6 doesn't support entities with type parameters, so this (ironically) meant adding a whole bunch more (mostly redundant) type parameters to IdentityDbContext, RoleStore, UserStore and everywhere that cascades to, which I believe is how the Identity 2 EF6 store is implemented too.
There's some commented out code in IdentityDbContext which actually seems to be redundant, below the builder definition for TUserRole:
            // Blocks delete currently without cascade
            //.ForeignKeys(fk => fk.ForeignKey<TUser>(f => f.UserId))
            //.ForeignKeys(fk => fk.ForeignKey<TRole>(f => f.RoleId));

But this is already declared above in the definitions of TRole and TUser and those FKs definitely already get generated.
Anyhow, what I've done is not very much work but on @Eilon 's advice, I'd like to contribute this back to the project (and I'm supposed to also mention @divega @rustd and @haok in this message!).
There's still another big issue, though, that I've also partially solved:  If using the "kpm wrap" method of integrating an EF6 context into an aspnet5 project, an EF6 Identity.EntityFramework package can't be a single package that contains the POCOs, the DbContexts, UserStore & RoleStore and the builder extensions; the UserStore, RoleStore and builder extensions all depend on the core Identity package and therefore can't be referenced from .csproj style project.  So, either this would need to be split into two different packages (a .csproj project and a aspnet5 project that depends on it) or we'd need an alternative to the "kpm wrap" method:
…which I have a working proof-of-concept of.  I wrangled DbMigrator and Scaffolder in EF6 to work inside of a aspnet5 project in a similar manner to the "k ef" series of migration commands and it works cleanly without needing access to any internal or private classes or members.
So, this means that we now have a cross-project dependency in order to get this working, which seems a bit daunting to me.  Is anyone willing to help me get this to happen?  I suppose EF6 migration commands for aspnet5 would be its own new package, right?

@cherrydev Thanks for the update, and great to hear you made all this progress.
Regarding the possibly redundant code in OnModelCreating() I believe we have a few workarounds in place for features that are still not implemented in the current EF7 bits but that should be there for RTM. @suhasj has been making updates to this model, so it would be good if we can take a look.
I actually would have expected you to have to split the packages between the "base data model" (i.e. base entity types and derived DbContext) and the stores. The application itself will also have to maintain a separate .csproj project with its data model if they want to use EF6 and be able to use migrations. They can put any customizations for the Identity data model in there too.

…which I have a working proof-of-concept of. I wrangled DbMigrator and Scaffolder in EF6 to work inside of a aspnet5 project in a similar manner to the "k ef" series of migration commands and it works cleanly without needing access to any internal or private classes or members

That sounds super interesting though. If it can be made to work without a lot of hacks we can consider it too.
cc @bricelam @rowanmiller

As for the E6 migrations, it's not any sort of hack at all.  It just uses the (public) DbMigrator and Scaffolder classes to create the .cs, Designer.cs and .resx files or update the database, which is what the PowerShell commands do.  The only significant work to really do now is to get the command line processing and options sorted out.

@cherrydev anything we can help on this?

Thanks for the reminder.  Now that I'm using the non-daily beta4 releases I should do some cleanup that fits better with this release.  I'm a bit unsure where to go with the portion of the code for doing the EF6 migrations, since it's nothing specific for Identity, and it's not related to EF7.  Basically, there doesn't seem to be a place for it in the aspnet github project umbrella.  Any advice?

cc @bricelam in case he has any insights on where to put the EF6 migrations command code. It wouldn't bother me if it was in the same repo as the EF6 provider for Identity at least at the start.

:+1: I would very much like to see this make the initial 3.0 release.

I have created a direct port of Identity.EntityFramework namespace (RC1) to EF6:
https://github.com/EntrypointSoft/AspNet.Identity.EntityFramework6
Would somebody be interested to incorporate it?

@ghrapan Thanks for the heads up. Have you considered a strategy to have automated test for this provider? Is there anything we can do, .e.g. refactoring our tests to enable reuse?
@cherrydev since you asked the same question first, are you still interested in contributing this? Did you ever get to implement automated tests for your provider?

@divega It loos like what @ghrapan has is probably a bit further ahead than what I have, though what I have seems to work for my use cases so far.  I think my private version uses a much earlier beta of AspNet.Identity.EntityFramework as a starting point and assuming that he's started with something much more recent, his implementation is probably more robust than mine is.
My sticking point for contribution right now is the fact that there is still no DNX support for EF6 commands officially available and while I'd be happy to contribute that work that I've been doing on that, I don't want to publish something that's either going to end up obsolete in a couple more months (if the existing EF6 PS commands somehow become usable with DNX), or stay responsible for maintaining it for the community without at least an endorsement from MS.  The last I heard from you during the summer (here), it was still under discussion.  I've poked you once since then but haven't gotten a response, so I've been waiting on some sort of word about what, if any, plans there are within MS for supporting EF6 commands on DNX.

@divega Feel free to e-mail me at this username at gmail if you want to discuss it.

@cherrydev Personally I am not sure that PowerShell commands and a DNX-like command line interface are full replacements for each other. And sorry I didn't come back to you on that thread but the truth is that many things are being discussed about the command line tools, e.g. https://github.com/aspnet/EntityFramework/issues/3925.
What about the automated test part?

No, I have not specifically write automated tests for the EF provider for the Identity framework.  I have, however, ported over a portion of the EF7 self-test utilities that automate the creation and destruction of databases for the purposes of tests.  That might be a prerequisite to writing effective and efficient tests for a EF6 identity provider.

I have also created an EF6 library for Identity 3. Its quite important because EF7 is not that feature-complete.
You can take a look here:
https://github.com/OneBitSoftware/Microsoft.AspNet.Identity.EntityFramework6
All unit tests pass and I have included a sample MVC6 project so people can get started easily. I would love to put more work in and get it contributed.

For anybody looking for a dnx based EF6 migrator, I've implemented one here: Migrator.EF6.

We are not planning on releasing our own EF6 provider, but we think this would be something valuable for the community to provide.

@HaoK
The problem is there are zillion of implementations with not a single one even recommended officially. You don't want to implement one yourself that's fine, please at lease recommend one officially.
Here's my small wrapper.

authors: HaoK SharePointRadi ToddThomson cherrydev divega ghrapan mrahhal rustd weitzhandler

repo: aspnet/Identity


text:
ReactRedux template doesn't compile in strict mode

Even though I'm not sure if TypeScript's strict should be activated by default, I think that the templates should at least compile when a user decides to enable strict mode.
At the moment the ReactRedux template throws a few issues:

./ClientApp/boot-client.tsx:5:30 TS7016: Could not find a declaration file for module 'react-hot-loader'.

./ClientApp/configureStore.ts:15:51 TS7006: Parameter 'f' implicitly has an 'any' type.

./ClientApp/configureStore.ts:33:27 TS7006: Parameter 'allReducers' implicitly has an 'any' type.

./ClientApp/store/WeatherForecasts.ts:63:7 TS2322: Type '{ startDateIndex: null; forecasts: never[]; isLoading: false; }' is not assignable to type 'WeatherForecastsState'. Types of property 'startDateIndex' are incompatible. Type 'null' is not assignable to type 'number'.

All of these issues can be fixed with just small modifications. Should I create a PR?

Even with strict mode turned off, I get these errors:
ERROR in [at-loader] ./ClientApp/routes.tsx:9:12
    TS2322: Type '{ exact: true; path: "/"; component: typeof Home; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
  Type '{ exact: true; path: "/"; component: typeof Home; }' is not assignable to type 'Readonly<T>'.
ERROR in [at-loader] ./ClientApp/routes.tsx:10:12
    TS2322: Type '{ path: "/counter"; component: typeof Counter; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
  Type '{ path: "/counter"; component: typeof Counter; }' is not assignable to type 'Readonly<T>'.
ERROR in [at-loader] ./ClientApp/routes.tsx:11:12
    TS2322: Type '{ path: "/fetchdata/:startDateIndex?"; component: typeof FetchData; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
  Type '{ path: "/fetchdata/:startDateIndex?"; component: typeof FetchData; }' is not assignable to type 'Readonly<T>'.

These errors are independent from strict mode, therefore it would be better to create a new issue on github. However I can confirm that these errors arise when creating a new project via yo.

Facing the same problem. These errors arise while creating a new React-Redux Project.

i don't face any issues while running restore or npm install however, when I run the application these are errors I get.
  ERROR in [at-loader] ./ClientApp/routes.tsx:10:12
      TS2322: Type '{ path: "/counter"; component: typeof Counter; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
    Type '{ path: "/counter"; component: typeof Counter; }' is not assignable to type 'Readonly<T>'.

  ERROR in [at-loader] ./ClientApp/routes.tsx:11:12
      TS2322: Type '{ path: "/fetchdata/:startDateIndex?"; component: typeof FetchData; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
    Type '{ path: "/fetchdata/:startDateIndex?"; component: typeof FetchData; }' is not assignable to type 'Readonly<T>'.

  ERROR in [at-loader] ./node_modules/@types/react-router/index.d.ts:67:21
      TS2694: Namespace 'React' has no exported member 'ComponentType'.

  ERROR in [at-loader] ./node_modules/@types/react-router/index.d.ts:102:48
      TS2694: Namespace 'React' has no exported member 'ComponentType'.
  Child extract-text-webpack-plugin:
      chunk    {0} extract-text-webpack-plugin-output-filename 4.08 kB [entry] [rendered]
          [0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
          [1] ./~/css-loader!./ClientApp/css/site.css 1.82 kB {0} [built]

`

As I mentioned that has nothing to do with this issue. In #1099 a temporary workaround has been posted:
Update your package.json file to:
    ...
    "@types/react": "15.0.35",
    "@types/react-dom": "15.5.1",
    "@types/react-redux": "4.4.45",
    "@types/react-router-dom": "4.0.6",
    "@types/react-router-redux": "5.0.3",
    ...
    "typescript": "2.3.4",

Afterwards you just have to restore the packages, then the ReactRedux template should work again.

Thanks @stephtr for the pull request. That's now merged, so this issue is fixed.
Also, strict mode is now enabled in all the templates by default. I can't think of much of a reason people would want to avoid that, but if they do, it's much easier to turn off than to turn on.

Awesome, thank you! 👍

authors: SteveSandersonMS anmolmahatpurkar mcquiggd stephtr varunpsr

repo: aspnet/JavaScriptServices


text:
Provide a nice error message when the HTTPS certificate is not configured for the current environment

Currently if you have a kestrel endpoint configured with a named certificate that isn't configured for the current environment you get an exception telling you that the certificate is missing. We should handle this exception and provide a reasonable error message to the user.
Current behavior:
~\Desktop\templates2\mvc-individual> $env:ASPNETCORE_ENVIRONMENT=""
~\Desktop\templates2\mvc-individual> dotnet run

Unhandled Exception: System.InvalidOperationException: No certificate named HTTPS found in configuration
   at Microsoft.AspNetCore.KestrelServerOptionsSetup.<>c__DisplayClass4_0.<BindEndPoint>b__0(ListenOptions listenOptions)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions.Listen(IPEndPoint endPoint, Action`1 configure)
   at Microsoft.AspNetCore.KestrelServerOptionsSetup.BindEndPoint(KestrelServerOptions options, IConfigurationSection endPoint, Dictionary`2 certificates)
   at Microsoft.AspNetCore.KestrelServerOptionsSetup.BindConfiguration(KestrelServerOptions options)
   at Microsoft.Extensions.Options.LegacyOptionsCache`1.CreateOptions()
   at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
   at Microsoft.Extensions.Options.LegacyOptionsCache`1.get_Value()
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.CreateServiceContext(IOptions`1 options, ILoggerFactory loggerFactory)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer..ctor(IOptions`1 options, ITransportFactory transportFactory, ILoggerFactory loggerFactory)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureServer()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at mvc_individual.Program.BuildWebHost(String[] args)
   at mvc_individual.Program.Main(String[] args)

Proposed behavior:
~\Desktop\templates2\mvc-individual> $env:ASPNETCORE_ENVIRONMENT=""
~\Desktop\templates2\mvc-individual> dotnet run

No certificate named HTTPS found in configuration for the current environment (Production). For information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.

@muratg Can we get this in for preview1?

Yeah definitely should get in for preview1.
@muratg - can you assign?

@cesarbs - BTW the FWLink in the error message is already the right one to use (Dan just created it).

repo: aspnet/MetaPackages


text:
Create a filter/sample that shows how to configure form size limits

We want an example of a filter that shows how to configure the limits used to read the form (by replacing FormFeature). This should be an IAuthorizationFilter configured to run before antiforgery.
See aspnet/Mvc#4533 for more information

86147eda46a476b8acc409df0eaa9b0eca730e94

Has this sample been published anywhere??

@M-Curtis it's located here - https://github.com/aspnet/Entropy/blob/dev/samples/Mvc.FileUpload/Controllers/RequestFormLimitsController.cs

authors: M-Curtis kichalla pranavkm rynowak

repo: aspnet/Mvc


text:
Simple Ajax post not working in ASP.NET MVC Core 1.1

I've created a test ASP.NET Core app following this official ASP.NET MVC Core tutorial. When I click the Test button in the view it makes a Ajax call that is supposed to post the Edit action. But instead, I get the error shown in the image below. I've not changed any folder structure or the controller or the action name etc. Everything is exactly the same as in tutorial above. The only change is that I've added an extra Test button and an Ajax code at the end of the view. NOTE: I'm using VS2015 with all the latest updates
Controller:
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("ID,Genre,Price,ReleaseDate,Title")] Movie movie)
{
    if (id != movie.ID)
    {
        return NotFound();
    }

    if (ModelState.IsValid)
    {
        try
        {
            _context.Update(movie);
            await _context.SaveChangesAsync();
        }
        catch (DbUpdateConcurrencyException)
        {
            if (!MovieExists(movie.ID))
            {
                return NotFound();
            }
            else
            {
                throw;
            }
        }
        return RedirectToAction("Index");
    }
    return View(movie);
}

View [..\views\movies\Index.cshtml]. NOTE: I've only added an extra button <button type="button" id="testid" class="Savebtn">Test</button>  and the Ajax call at the end.
@model MovieGenreViewModel

@{
    ViewData["Title"] = "Index";
}

Index

    Create New

<form asp-controller="Movies" asp-action="Index" method="get">

        <select asp-for="movieGenre" asp-items="Model.genres">
            <option value="">All</option>
        </select>

        Title: <input type="text" name="SearchString">
        <input type="submit" value="Filter" />

</form>

                @Html.DisplayNameFor(model => model.movies[0].Genre)

                @Html.DisplayNameFor(model => model.movies[0].Price)

                @Html.DisplayNameFor(model => model.movies[0].ReleaseDate)

                @Html.DisplayNameFor(model => model.movies[0].Title)

@foreach (var item in Model.movies) {

                @Html.DisplayFor(modelItem => item.Genre)

                @Html.DisplayFor(modelItem => item.Price)

                @Html.DisplayFor(modelItem => item.ReleaseDate)

                @Html.DisplayFor(modelItem => item.Title)

                <button type="button" id="testid" class="Savebtn">Test</button>
                Edit |
                Details |
                Delete

}

@section scripts
{

}

Error [in Google Chrome developer tool when Test button is clicked to make an Ajax call]:

Can you provide a link to a repo for the project you're working from?

I found the error. You have to have the same input parameters in Ajax data attribute that you have in Controller action you are calling.. For example, if you have controller action Edit(int id, string myParam){...} you also need to have data attribute value in Ajax as data: {id: 123, myParam: "Test data"}

@NRKirby Thank you for looking into the issue. I've found the error as explained in my previous comment above.

No problem - have you considered using StackOverFlow for questions like this?

authors: NRKirby saf-itpro


text:
Razor Pages Feedback - First impressions. Not good enough (yet).

TL;DR: I want to be able to customize URLs, Methods Names and the solution tree (folders/files) totally freely and also have better defaults.
Disclaimer: probably most stuff I point out is possible/configurable, I didn't spend huge amount of time, the way that was intuitive for me didn't work and wanted to give feedback, hence keyword is first impressions

@DamianEdwards talk about how this is a best fit for "feature folders" that I use in MVC and I agree that the configuration is kind of a clunky. but after 10 minutes of use I find it lacks some very important/key aspects I want to share with the team.

_ViewImports, _Layout, _ViewStart, should not be on Pages root folder by default. This clutters the root folder.

Partial/Shared are currently searched on Views folder and not Pages folder. This feels really weird. I think there's should be an abstraction on ViewLocator on where/which root folder it should search for views that is configurable so MVC can use Views and RazorPages can use Pages or something like that.

Attribute Routing does not work ? I tried to move Index.cs* outside of Pages/ to something like Pages/Home and put [Route("")] at the cs file hoping to work but failed miserably. Maybe there's some way to do this ? It would be great if attribute routing works just as it does on mvc. Switching context shouldn't be that different.

handlers and prefixed On methods: I would like to customize my urls/methods to my hearts intent. This is very critical feature for me.

The defaults are ugly. OnGet / OnPost, / OnGetAsync, etc. I would really liked it more to be Get / Post (like web api) and just be async/sync based on the return type (IActionResult (?) ).
I also hopped that I can use AttributeRouting here [Get("account")] to define the route. I don't like the custom handler thing that was implemented on Razor Pages at all.

At this point, the solution tree, the method names and the handler thing make this too subpar to feature folders on mvc I had to stop researching into pages. I really wished this works as expected 😞 I see lot of potential and I see how I could prefer it over MVC but right now I think it needs more work.
From my understanding, people that want/like feature folders (like me) do really care a lot on crafting methods names, routing names (urls), and specially folder structure (good defaults are very welcome), razor pages is failing on those 3 points at the moment.
This is not a rant, it's just constructive feedback on my first impressions. I really want Razor Pages to  be a better development model than mvc! I do care and that's why I do post this issue.
Hope it helps!
p.s.: maybe consider a github repo for razor pages only ? if there's one sorry, couldn't find it.

Thanks for the feedback. I'll try to address each of your points:

_ViewImports.cshtml and _ViewStart.cshtml work the same way as they do with views, so they have to be hierarchical (you can't put them in Shared for views either). We could potentially change that in the future for both, but it works the same way today. _Layout can be wherever you like but I prefer it in the root. Each to their own.
Yes, we don't search inside a Shared folder in the configured pages root by default, but you can change that. See https://github.com/aspnet/Mvc/issues/6534#issuecomment-314826066 for details. We landed on the side of following default conventions from page-focused frameworks rather than MVC's view search patterns (when working exclusively with pages), but we can revisit adding Shared as a search path by default in the next release.
We made an implementation decision in this version to allow us the freedom to change the way we find and compile pages in the app in the future, and that decision prevented us from supporting attribute routes on PageModel classes. There's a trade-off to be made here given the way routing has to interplay with the dynamic nature of CSHTML files (we detect page files coming and going while the app is running). Today we scan for all pages up front when the app starts in order to discover their route information, but that doesn't involve compiling the page (yet) so we can't correctly determine its PageModel (at this stage) in order to discover an attribute route and thus update the route table. Other attributes (like filter attributes) work on the PageModel because they're evaluated at a later stage, after the pages have been compiled. In our testing, scanning the pages of a very large app (e.g. 1,000 pages) only takes a few hundred ms, so this might be something we can just not worry about in order to support this feature (which lots of people have asked for).
You can change the handler method naming conventions. See @hishamco's blog post at http://www.hishambinateya.com/customize-razor-pages-handlers for a good example. The Async suffix is completely optional by default, so you can just not put it there. The way page handler dispatching works was inspired and intended to work well with how HTML5 formaction works, and you can easily state that you want the handler name to be passed by a segment in the route rather than the query string (@page "{handler?}", or do it globally with an IPageRouteConvention), because it all comes from routing ultimately. Again, we landed on making the handler name conventions follow page-focused patterns by default, rather than controller or Web API style naming. We can look at adding more conventions in the box by default in the future so switching is a simple one-liner in Startup.cs. Also, you can add a route in Startup that maps any given URL to a specific handler method on a specific page. You just can't specify it via an attribute due to the reasons above (again, we could revisit that in the next minor release).

Much of this is subjective (other than the attribute routing lifetime issue which I explained). I invite you to try using the approaches above to configure the Razor Pages conventions to your preferences.

I'm totally agree with what @DamianEdwards mentioned before, and I have something to add:

I'm agree that it would be nice if we searched into /Pages/Shared, look to my comment here, and you are free to create a custom IViewLocationExpander like what I did in my ThemeViewLocationExpander in my Bloggy repo
I advice you to try the convention-based routing, which is IMHO suitable for page focus scenarios, you could check my blog post http://hishambinateya.com/friendly-urls-in-razor-pages, also https://www.mikesdotnetting.com/article/310/routing-in-razor-pages
I wrote a simple blog post http://www.hishambinateya.com/customize-razor-pages-handlers to show how you can customize the page handler methods, also you can go further to implement a convention-based once via ApplicationModel if you do so

Please take enough time to discover the RazorPages features, and I'm sure you will change your thoughts  😄

@DamianEdwards @hishamco Thanks for the detailed and useful response and information.
I certainly will be investing more time in Razor Pages and play with it more in depth by it's rules and not mines ;) and see how it goes.
Looks like I can achieve most of my needs with simple configuration. 🎉 !
also makes me very happy that point 3 and point 4 may be addressed in the future if/when Attributes on PageModel can be used. I'll let you know how it goes!

@Bartmax I wrote a sample that shows how you'd use page application model to configure the naming of handlers.

Here's the provider: https://github.com/pranavkm/customizable-page-handlers/blob/master/MainApp/CustomHandlerPageApplicationModelProvider.cs
The resulting handler name convention: https://github.com/pranavkm/customizable-page-handlers/blob/master/MainApp/Pages/Index.cshtml

Thanks @pranavkm for the sample that you provide, it would be nice if we add the handler to the route by default instead of adding it in the page itself @page "{handler?}"

@hishamco it's trivial to add this globally using a page route model convention:
using Microsoft.AspNetCore.Mvc.ApplicationModels;
...

.AddMvc()
.AddRazorPagesOptions(options =>
{
    options.Conventions.AddFolderRouteModelConvention("/", model =>
    {
        foreach (var selector in model.Selectors)
        {
            var attributeRouteModel = selector.AttributeRouteModel;
            attributeRouteModel.Template = AttributeRouteModel.CombineTemplates(attributeRouteModel.Template, "{handler?}");
        }
    });
});

Thanks a lot @pranavkm, but the AddFolderRouteModelConvention() in your case above it will add the handler for root pages if I'm not wrong
I'm not sure if it will cover the pages that available in the nested folders?!!

AddFolderRouteModelConvention is invoked for all files that belong to the specified directory (recursively).

I think I will write another blog post handlers & routing with the built-in model conventions
thanks again ..

I'm trying out Razor Pages, as I prepare for an ASP.NET Core 2 talk (which Razor Pages is gonna take up ~25 of the 75 minutes), and these are my thoughts:

+1 for attribute routes.  I think it's a little strange that the "{handler?}" route token is on the Page itself and not the PageModel.  I know that you can probably just avoid using that if Attribute Routing lands in Razor Pages and you'll just configure it on the PageModel, but it still seems a bit strange.
The inline functions and stuff on the docs has to go, ESPECIALLY when it's in the beginning of the article.  My co-workers took a 2 minute look at Razor Pages by visiting those docs and gave it a big ol' NOPE, because of that.  I'm now fighting an uphill battle to give Razor Pages a second look.  I would just take the inline stuff out entirely, but at least put it at the end or something, not the beginning.  I doubt many people will put their PageModel directly on their view page in practice.  It also doesn't help that some of the demos I've seen by MS employees also open with this approach or promote Razor Pages as "for simple things."  I think this is a mistake.  I won't be showing the functions directive at all in my talk.
I haven't quite locked in on where I've landed on this yet, but I feel like having a separate View Model class and hanging that off of PageModel feels right (especially for larger views) to avoid cluttering up the PageModel with a bunch of props.  I'll be curious what patterns crop up in the community.

Otherwise - I love the Page focused approach.  Seems like it's much harder to end up with a big ball of mud than Controllers with too many actions. 👍
FWIW - I also was converting MVC Pages/Controllers to Razor Pages and took me about 4-5 minutes per Action (including GET and POST).  Love how smooth a lot of the code comes over.

Thanks for the feedback folks. I logged a bunch of issues to cover these items (and some others) which I hope to get done as part of the next minor release:

#6604
#6605
#6562
#6525
#6602
#6603
#6601

How can I prevent Razor Page to accept Post request when those are not defined on PageModel ?
It's very weird default behavior, as I see, post is accepted, no method will be executed and Page.cshtml will be loaded, since the Get method won't get executed, any initialization data will be empty (or null) leading to easily get exceptions instead of Not Found or Method not allowed status code.
Sample code with commented workaround.
public class IndexModel : PageModel
{
    private readonly ApplicationDbContext context;
    public IndexModel(ApplicationDbContext context)
    {
        this.context = context;
    }

    public IList<RestoreData> Restores { get; private set; } = new List<RestoreData>();

    public async Task OnGet()
    {
        Restores = await context.Restores
            .AsNoTracking()
            .ToListAsync();
    }

    //public IActionResult OnPost()
    //{
    //    return NotFound();
    //}
}

/cc @DamianEdwards

Any updates on the Scott's comment regarding docs? Definitely agree on this one.

The inline functions and stuff on the docs has to go, ESPECIALLY when it's in the beginning of the article. My co-workers took a 2 minute look at Razor Pages by visiting those docs and gave it a big ol' NOPE, because of that. I'm now fighting an uphill battle to give Razor Pages a second look. I would just take the inline stuff out entirely, but at least put it at the end or something, not the beginning. I doubt many people will put their PageModel directly on their view page in practice. It also doesn't help that some of the demos I've seen by MS employees also open with this approach or promote Razor Pages as "for simple things." I think this is a mistake. I won't be showing the functions directive at all in my talk.

@DamianEdwards anything you can do?

I thought the docs had already been updated to remove or at the very least downplay those examples. I'll check again.

@Bartmax you could likely do that with a page filter by detecting the incoming verb has no matching handler, and then shortcutting execution. I don't necessarily agree that pages without handlers for the incoming verb should not run however, but this does seem to be a vote for adding support for an initialization method on pages, just runs before all handlers. Again, that could be prototyped via a filter.

I don't necessarily agree that pages without handlers for the incoming verb should not run

Would you mind to expand on this please? I see how GET and HEAD action are a nice feature to work without a method defined on the PageModel but I fail to see how or why this could be useful for a POST verb (and put, patch, etc. Any non-indepotent verb for that matter).

Is there a setting to have runtime compilation when using PageModel?

@Code-DJ you can use the Watcher from DotNet Tools https://github.com/aspnet/DotNetTools/tree/dev/src/Microsoft.DotNet.Watcher.Tools

@hishamco just to be sure - In the webforms WebSite project, you could deploy both .aspx and .aspx.cs to the server without requiring pre-compilation. This meant that there was not need to deploy DLL to the bin folder when you made changes to your .aspx.cs files. Having to deploy DLLs caused a 1-2 second freeze of the app.
While I like the compilation/test steps during development for .cshtml.cs files. I wanted to see if there was a way to avoid pre-compilation for deployment. It's not a big deal, just wanted to find out if there was an option. Thanks!

@Code-DJ I think it would be nice if you create a new issue to track it easily and listen from the other folks

Thanks @hishamco created #6760

Since Nadella is on board I don't jump in to easily anymore. Fool me once shame on you. Fool me twice, shame on me. Invested a lot in WPF for Mobile. Saw lots of things get dumped from Microsoft. Haha, Microsoft Software starts to look like Open Source, no backwards compatability, support etc.

authors: Bartmax Code-DJ DamianEdwards Ibro hhvdblom hishamco pranavkm scottsauber


text:
First commit

What are good labels for a first commit?

"Initial create" or "First commit" ))

Hi @Matthiee.
What are you trying to do? Are you looking for issues you can handle as your first contribution?

@mkArtakMSFT yes I'm looking for issues to handle as my first contirbution.

That's great. You can look for issues marked with up-for-grabs label. It's available across multiple repos in aspnet organization. Here are all the up-for-grabs issues in aspnet/mvc repo: https://github.com/aspnet/mvc/issues?q=is%3Aopen+is%3Aissue+label%3Aup-for-grabs

authors: Matthiee mkArtakMSFT proggmatic


text:
Add Razor.Workspaces to non-shipping in NPV

Putting this package where it belongs in the NPV list. This package only
ships with our other tooling-only packages.
Fixes: https://github.com/aspnet/AspNetCore-Internal/issues/1219

I'm adding this package to the list of similar packages in the NPV.json - I think this was just an oversight.
If we want to define a set of rules for our tooling only packages, feel free to make a suggestion - I'm not planning to drive that.

I see this in 2.2 still @rynowak http://aspnetci/viewLog.html?buildId=585577&buildTypeId=Releases_22xPublic_UniverseCoherence&tab=buildLog&_focus=4359

authors: mmitche rynowak

repo: aspnet/Razor


text:
How to implement the option - "Login as another user" with windows authentication using .NET Core

I have tried to implement the option like "Login as another user" with Windows authentication - I have used the code snippet from SO - (https://stackoverflow.com/questions/17871816/login-as-another-user-mvc-4-windows-authentication/25672345#25672345):
public ActionResult LogOut()
{
    HttpCookie cookie = Request.Cookies["TSWA-Last-User"];

    if(User.Identity.IsAuthenticated == false || cookie == null || StringComparer.OrdinalIgnoreCase.Equals(User.Identity.Name, cookie.Value))
    {
        string name = string.Empty;

        if(Request.IsAuthenticated)
        {
            name = User.Identity.Name;
        }

        cookie = new HttpCookie("TSWA-Last-User", name);
        Response.Cookies.Set(cookie);

        Response.AppendHeader("Connection", "close");
        Response.StatusCode = 401; // Unauthorized;
        Response.Clear();
        //should probably do a redirect here to the unauthorized/failed login page
        //if you know how to do this, please tap it on the comments below
        Response.Write("Unauthorized. Reload the page to try again...");
        Response.End();

        return RedirectToAction("Index");
    }

    cookie = new HttpCookie("TSWA-Last-User", string.Empty)
    {
        Expires = DateTime.Now.AddYears(-5)
    };

    Response.Cookies.Set(cookie);

    return RedirectToAction("Index");

}

Is it possible to use following code snippet with .NET Core? I have tried to rewrite this snippet with methods in .NET Core but there are missing things like - Response.End etc.
How can I do it something similar in .NET Core?
Thx.

What a weird example. The only part that looks related to windows auth is the 401 status code and maybe the connection close.

OK, I think it is inspired from the SharePoint - there is a feature - "Sign in as a Different User", I need achieve same thing in my intranet ASP.NET Core app.
Any ideas how to implement it? - We have the users with more accounts and I'd like to solve it.
Thx.

Here's how you can do that with ADFS + OIDC:

Trigger SignOut with a redirect uri pointing to an anon endpoint in your AccountController
In that SignOutCallback method, set a flag using AuthenticationProperties and trigger Challenge()

            var props = new AuthenticationProperties
            {
                RedirectUri = url,
            };
            props.Items.Add("login-prompt", "true");
            return Challenge(props);

In your OIDC config setup events and adjust the protocol message to set Prompt="login";

                    options.SaveTokens = true;

                    options.Events.OnRedirectToIdentityProvider = ctx =>
                        {
                            switch (ctx.ProtocolMessage.RequestType)
                            {
                                case OpenIdConnectRequestType.Authentication:
                                    if (ctx.Properties.Items.ContainsKey("login-prompt"))
                                    {
                                        ctx.ProtocolMessage.Prompt = "login";
                                    }
                                    break;
                                case OpenIdConnectRequestType.Logout:
                                    var cp = ctx.HttpContext?.User?.Identity as ClaimsIdentity;
                                    if (cp?.BootstrapContext != null)
                                    {
                                        ctx.ProtocolMessage.IdToken = cp.BootstrapContext as string;
                                    }
                                    break;
                            }

                            return Task.FromResult(0);
                        };

Yea, sharepoint if it shows this option is not using Integrated Authentication, it's using OIDC.

Our legacy intranet apps (before ADFS) had this requirement and the way we handled this was by having a <location> tag in the web.config and just for that location enabled windows auth. Rest was anonymous. So when a request came in, the application (auth filters) would see if user can do WIA and then redirect to that special endpoint. That endpoint would then use the windows identity and create a session cookie. When the user cannot do WIA, a login page was displayed to do forms auth. That was also used when a user explicitly signed out (so you can login as a different user).
Just curious if something like that can be done in asp.net core? Can we have only some endpoints do Windows Auth?

Just curious if something like that can be done in asp.net core? Can we have only some endpoints do Windows Auth?

Found the answer here which points to an example here

Closing because there doesn't appear to be any action remaining in the Security repo.

authors: Eilon Jenan Tratcher blowdart rasitha1

repo: aspnet/Security


text:
Reacting to Caching api review changes

@Tratcher

Hi @kichalla, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.
TTYL, DNFBOT;

:shipit:

authors: Tratcher dnfclas kichalla


text:
Use message formatters defined by host

I set default enum serialization as string
            services.AddMvc()
                    .AddJsonOptions(opt =>
                    {
                        var settings = opt.SerializerSettings;
                        settings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
                    });

But old one SignalR did not use that.

Those are MVC options, SignalR doesn't know about MVC.

What about aligning this together?
Anyway MVC is required if you want to use SignalR with ASP.NET

Having a way to set both things would good but not via mvc. Also mvc isn't required to use SignalR with asp.net.

Having a way to set both things would good but not via mvc. Also mvc isn't required to use SignalR with asp.net.

Kind of related: https://github.com/aspnet/SignalR/issues/73

@davidfowl, so as I understand from your presentations it is implemented, isn't it?

It's tracked here https://github.com/aspnet/SignalR/issues/261

authors: davidfowl moozzyk xperiandri

repo: aspnet/SignalR


text:
Cleanup ANCM installers

For https://github.com/aspnet/Universe/issues/1496
@natemcmaster I still need to investigate signing issues with the aspnetcoreca.dll.

@natemcmaster  🆙 📅

repo: aspnet/Universe


text:
implementation de getManyReference

besoin de faire fonctionner ReferenceManyField de react-admin

Ah oui j'ai vu "target" dans la doc de React-Admin.
Ils donnent un exemple avec target: 'post_id'.
Ca correspond à la relation inverse ?

Avec ton composant tu pourrais très bien appeler getList en indiquant un filtre supplémentaire (le "target"), et avoir exactement le même résultat.

J'ai pas compris pourquoi tu parles de "mon composant". getManyReference ne peut pas appeler getList directement il me semble d'ou le besoin d'avoir mutualisé une fonction.

repo: assemblee-virtuelle/semapps


text:
AWS Deploy hangs and then times out

When I do npm run deploy, this is what I get in the terminal. The lambda upload function doesn't complete, and later fails with a timeout. Does anyone have any clues as to why this is happening? Thanks!
=> Running npm install --production
=> Zipping deployment package
=> Zipping repo. This might take up to 30 seconds
=> Reading zip file to memory
=> Reading event source file to memory
=> Uploading zip file to AWS Lambda eu-east-1 with parameters:
{ FunctionName: 'cloudwatch-to-slack-2',
  Code: { ZipFile: <Buffer 50 4b 03 04 14 00 08 00 08 00 a4 ab 39 4e 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 2e 44 53 5f 53 74 6f 72 65 ed 57 4d 6c dc 54 10 9e 6f b3 4d ... > },
  Handler: 'index.handler',
  Role: 'arn:aws:iam::xxxxxxxxxxx:role/cloudwatch-to-slack-role',
  Runtime: 'nodejs8.10',
  Description: 'Better Slack notifications for AWS CloudWatch',
  MemorySize: 128,
  Timeout: 60,
  Publish: false,
  VpcConfig: { SubnetIds: [], SecurityGroupIds: [] },
  Environment: { Variables: { UNENCRYPTED_HOOK_URL: 'https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXX } },
  KMSKeyArn: '',
  DeadLetterConfig: { TargetArn: null },
  TracingConfig: { Mode: null } }
{ Error: connect ETIMEDOUT 92.242.140.21:443
    at Object._errnoException (util.js:1041:11)
    at _exceptionWithHostPort (util.js:1064:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1153:14)
  message: 'connect ETIMEDOUT 92.242.140.21:443',
  code: 'NetworkingError',
  errno: 'ETIMEDOUT',
  syscall: 'connect',
  address: '92.242.140.21',
  port: 443,
  region: 'eu-east-1',
  hostname: 'lambda.eu-east-1.amazonaws.com',
  retryable: true,
  time: 2019-01-25T21:31:56.154Z }

I am facing the same issue. Does anyone have tips about it?

Hmm..that's interesting. I haven't hit this, but for anyone seeing the same issue, you might try to play with the timeout setting. Since it's not hitting an error, just a timeout, it could just be that it needs a little longer.
You can't change this directly in the env, but this package uses node-lambda so I believe you can set the AWS_TIMEOUT variable (mentioned here):
$ AWS_TIMEOUT=120 npm run deploy

Alternatively, you could edit the scripts/deploy.sh  file and add the --timeout flag to the very last line (that flag is mentioned here).
I would try that out first. If anyone does it and it seems to work, we can figure out how to add an option to this package for it.

I was eager to try your solution this morning, but the deploy worked directly with no timeout...
So problem fixed for me, but without knowing what would have been the fix
Thanks for helping anyways

authors: CodyReichert gokeji sallesma

repo: assertible/lambda-cloudwatch-slack


text:
Feature request: Optional API keys per assistant

Add option to add custom API keys per assistant.

@PatrickJongmans - good call out, will try to fix this for the next release

This is now completed @PatrickJongmans! You can now manage API credentials globally also have 1 API key per assistant. Please try out and let me know
https://github.com/assistants-hub/assistantshub.ai/assets/2665127/d648fbc7-4808-4570-ad58-a94ed8c8d0c3

authors: PatrickJongmans santthosh


text:
Professional contact

Hello Asticode, I must say i'm quite a big fan of your projects ( go-astitools saved my CI from burning last week ), I would love to send you littles bricks of nuts-juice by mail
Do you have any contact method ?
I heard you were quite the shit in India

Hello @uepoch,
You seem like quite the shit too on the Internet. May I know which package saved your CI from burning last week?
You should have a received an encrypted message on your Skype.
Bite
Cheers

authors: asticode uepoch

repo: asticode/go-astibob


text:
ci(docker): incorporate docker release enhancements from uv

Summary
This PR updates ruff to match uv updated docker releases approach. It's a combined PR with changes from these PR's

https://github.com/astral-sh/uv/pull/6053
https://github.com/astral-sh/uv/pull/6556
https://github.com/astral-sh/uv/pull/6734

Summary of changes / features

This change would publish an additional tags that includes only major.minor.
For a release with x.y.z, this would publish the tags:

ghcr.io/astral-sh/ruff:latest
ghcr.io/astral-sh/ruff:x.y.z
ghcr.io/astral-sh/ruff:x.y

Parallelizes multi-platform builds using multiple workers (hence the new docker-build / docker-publish jobs), which cuts docker releases time in half.

This PR introduces additional images with the ruff binaries from scratch for both amd64/arm64 and makes the mapping easy to configure by generating the Dockerfile on the fly. This approach focuses on minimizing CI time by taking advantage of dedicating a worker per mapping (20-30s~ per job). For example, on release x.y.z, this will publish the following image tags with format ghcr.io/astral-sh/ruff:{tag} with manifests for both amd64/arm64. This also include x.y tags for each respective additional tag. Note, this version does not include the python based images, unlike uv.

From scratch: latest, x.y.z, x.y (currently being published)
From alpine:3.20: alpine, alpine3.20, x.y.z-alpine, x.y.z-alpine3.20
From debian:bookworm-slim: debian-slim, bookworm-slim, x.y.z-debian-slim, x.y.z-bookworm-slim
From buildpack-deps:bookworm: debian, bookworm, x.y.z-debian, x.y.z-bookworm

This PR also fixes org.opencontainers.image.version for all tags (including the one from scratch) to contain the right release version instead of branch name main (current behavior).
> docker inspect ghcr.io/astral-sh/ruff:0.6.4 | jq -r '.[0].Config.Labels'
{
  ...
  "org.opencontainers.image.version": "main"
}

Test Plan
Approach mimics uv with almost no changes so risk is low but I still tested the fill workflow.

I have a working CI release pipeline on my fork
The resulting images were published to https://github.com/samypr100/ruff/pkgs/container/ruff

CC @zanieb

We haven't restructured the Ruff documentation to have integration guides like uv, so... eventually but not yet.

repo: astral-sh/ruff


text:
Add TOML files to SourceType

Summary
This PR adds a higher-level enum (SourceType) around PySourceType to allow us to use the same detection path to handle TOML files. Right now, we have ad hoc is_pyproject_toml checks littered around, and some codepaths are omitting that logic altogether (like add_noqa). Instead, we should always be required to check the source type and handle TOML files as appropriate.
This PR will also help with our pre-commit capabilities. If we add toml to pre-commit (to support pyproject.toml), pre-commit will start to pass other files to Ruff (along with poetry.lock and Pipfile -- see identify). By detecting those files and handling those cases, we avoid attempting to parse them as Python files, which would lead to pre-commit errors. (We tried to add toml to pre-commit here (https://github.com/astral-sh/ruff-pre-commit/pull/44), but had to revert here (https://github.com/astral-sh/ruff-pre-commit/pull/45) as it led to the pre-commit hook attempting to parse poetry.lock files as Python files.)

I feel similarly, which is that this is an improvement but the abstractions are lacking.


text:
Deprecate PGH001 in favor of S307

Summary
These rules are identical. Bandit is the more popular and more well-defined category, so we remove PGH001 and add a redirect to S307. (By adding the redirect, we ensure that users see a warning but not an error when they reference PGH001 in their configuration or in a # noqa, and that those codes seamlessly redirect to S307.)
Closes https://github.com/astral-sh/ruff/issues/7283.

Is this a breaking change? What do we need to document in the changelog?

Yes and no...
If users have PGH001 explicitly selected or ignored in their configuration file, we'll show a warning but automatically redirect it to S307.
If users have # noqa: PGH001, we'll similarly warn-and-redirect to S307.
The main problem here is that if users have PGH in their select, but not S, this rule will no longer run on their code. That's kind of an issue, because the rule is basically being silently turned off (and is the source of the ecosystem changes).
I'm not sure how best to resolve -- any ideas?

@zanieb - This one actually might be interesting to you too (especially my comment about regarding redirects).

We really should implement proper rule aliasing, this getting more and more unwieldy as we add new rules. It's really surprising when a new user migrates a flake8-plugin to ruff only to find they also have to enable a bunch of rules in different other categories to make functionality of the original plugin.

The main problem here is that if users have PGH in their select, but not S, this rule will no longer run on their code. That's kind of an issue, because the rule is basically being silently turned off

This sounds like a breaking change to me. Proper aliasing does sound like the better solution and probably something we need for recategorization anyway?

@zanieb Agree, public rule aliasing is probably one of the largest painpoints right now and it will only become a bigger maintenance burden on us later the more rules get added without this feature.

Separate from the larger conversation around rule aliasing (see my comment in the related issue), we should consider removing this whole category and marking it as a breaking change. There are so few rules, multiple of them are duplicates of other existing rules, and there's no semantic relationship between the various rules.

Proper aliasing does sound like the better solution and probably something we need for recategorization anyway?

I think there are ways for us to do a recategorization without aliasing, because it doesn't require that we support multiple codes at once for a given rule, only that we provide tooling to remap from existing to updated codes and categories.

Should we remove the whole category instead of this pull request? Either way I think we should probably gate removal with preview.

I’m in favor of that.

authors: MichaReiser Skylion007 charliermarsh zanieb


text:
Issue while resolving versions of editable packages.  uv pip install  -e {package}

Steps to reproduce

Install package A in editable mode
Install package B that relay on package A in editable mode

Expected result:
Packages A and B has been installed.
Actual result:
Audited 1 package in 3ms
uv pip install --prerelease=allow -e ecosystem/utils/ecosystem-utils-logging[test]
Audited 1 package in 4ms
uv pip install --prerelease=allow -e ecosystem/utils/ecosystem-utils-configuration[test]
   Built file:///Users/moaddib/PycharmProjects/spaceship/ecosystem.python/ecosystem/utils/ecosystem-utils-configuration                                                                                Built 1 editable in 829ms
  × No solution found when resolving dependencies:
  ╰─▶ Because ecosystem-utils-logging==0.0.1a0 was not found in the package registry and ecosystem-utils-configuration==0.0.1a0 depends on ecosystem-utils-logging==0.0.1a0, we can conclude that
      ecosystem-utils-configuration==0.0.1a0 cannot be used.
      And because you require ecosystem-utils-configuration==0.0.1a0, we can conclude that the requirements are unsatisfiable.
make: *** [install] Error 1

This is the same as https://github.com/astral-sh/uv/issues/1661. (Gonna merge into that issue. This one was first, but I wrote up some notes on the other issue by chance.)

Hi! This should be addressed in the latest release (0.1.27) via #2596.
Let us know if you have any problems.

authors: charliermarsh moaddib666 zanieb

repo: astral-sh/uv


text:
uv doesn't include environment markers in compiled output

In a current project I have an optional dependency that's not available on Windows - specifically, uvloop (used for better performance by uvicorn) is currently unavailable for Windows. As such, I set environment markers to only install that extra on non-Windows platforms. However, when I run uv pip compile it doesn't include the markers in the output requirements.txt.
uv version output:
uv 0.1.17 (bb2d06cbb 2024-03-10)

Minimal pyproject.toml:
[project]
name = "coolapp"
version = "0.1.0"
dependencies = [
    'fastapi~=0.110',
    'uvicorn[standard]~=0.27 ; platform_system != "Windows"',
    'uvicorn~=0.27 ; platform_system == "Windows"',
]

Relevant section of compiled requirements.txt
uvicorn==0.27.1
uvloop==0.19.0
    # via uvicorn
watchfiles==0.21.0
    # via uvicorn
websockets==12.0
    # via uvicorn

For now I'm just manually working aroung it by adding a ; platform_system ~= "Windows" on the line with uvloop before git committing, but that's obviously not ideal.

Should the ideal output also include extras? For example, the minimal example provided in the description produces the below when run through pip-compile:

pip-compile output
```
WARNING: --strip-extras is becoming the default in version 8.0.0. To silence this warning, either use --strip-extras to opt into the new default or use --no-strip-extras to retain the existing behavior.

This file is autogenerated by pip-compile with Python 3.12
by the following command:

pip-compile pyproject.toml

annotated-types==0.6.0
# via pydantic
anyio==4.3.0
# via
#   starlette
#   watchfiles
click==8.1.7
# via uvicorn
fastapi==0.110.0
# via coolapp (pyproject.toml)
h11==0.14.0
# via uvicorn
httptools==0.6.1
# via uvicorn
idna==3.6
# via anyio
pydantic==2.6.3
# via fastapi
pydantic-core==2.16.3
# via pydantic
python-dotenv==1.0.1
# via uvicorn
pyyaml==6.0.1
# via uvicorn
sniffio==1.3.1
# via anyio
starlette==0.36.3
# via fastapi
typing-extensions==4.10.0
# via
#   fastapi
#   pydantic
#   pydantic-core
uvicorn[standard]==0.28.0 ; platform_system != "Windows"
# via coolapp (pyproject.toml)
uvloop==0.19.0
# via uvicorn
watchfiles==0.21.0
# via uvicorn
websockets==12.0
# via uvicorn

</details>

We won't include extras by default (pip-compile is also removing them by default in the next release, hence the warning) and won't prioritize implementing them, but you can track here: https://github.com/astral-sh/uv/issues/1595.
For markers, you can track https://github.com/astral-sh/uv/issues/1429 (I'll merge into that issue), which is the same request. The one thing I'll say is that it isn't really safe to be using compiled requirements files this way, because you have no indication of the dependencies you're missing. Like, FastAPI could have some Windows-only dependency, and it just wouldn't show up at all in the resolution above, regardless of whether we preserve markers at all.

Not sure why I didn't find #1429 when searching issues - thanks!

No prob, took me a few searches and I already knew it existed :)

authors: ChannyClaus charliermarsh euan-reid