Closed MazeXP closed 2 years ago
Wild - you broke Razor! I've got some ideas how to fix this - I'm on vacation this week with limited access, but it'll be one of the first things I look at when I get back.
Alright, thanks for the fast response. Enjoy your vacation.
Hey Dave, I wanted to ask for some update on the topic.
Still trying to catch up unfortunately. Everyone always thinks "I'll have so much free time when I'm on vacation!" and then poof! Vacation is over and you haven't accomplished anything, though I guess that's what the vacation is for in the first place. It's still near the top of my priority queue and flagged in my todo app so I'll get to it the first chance I have bandwidth - just not entirely sure when that'll be.
Alright, thanks for the update. I could also take a look at the problem myself, when you point me into the right direction.
I do have this reproduceable now. The issue is that the class name for the generated Razor class is insane. Here's the generated code:
#pragma checksum "/Remora.Discord.API.Gateway.Events.MessageCreate.MessageCreate(Optional<Snowflake>, Optional<Remora.Discord.API.Abstractions.Objects.IPartialGuildMember>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IUserMention>, Snowflake, Snowflake, Remora.Discord.API.Abstractions.Objects.IUser, string, System.DateTimeOffset, System.DateTimeOffset?, bool, bool, System.Collections.Generic.IReadOnlyList<Snowflake>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IChannelMention>>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IAttachment>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IEmbed>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IReaction>>, Optional<string>, bool, Optional<Snowflake>, MessageType, Optional<Remora.Discord.API.Abstractions.Objects.IMessageActivity>, Optional<Remora.Discord.API.Abstractions.Objects.IPartialApplication>, Optional<Snowflake>, Optional<Remora.Discord.API.Abstractions.Objects.IMessageReference>, Optional<MessageFlags>, Optional<Remora.Discord.API.Abstractions.Objects.IMessage?>, Optional<Remora.Discord.API.Abstractions.Objects.IMessageInteraction>, Optional<Remora.Discord.API.Abstractions.Objects.IChannel>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IMessageComponent>>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IStickerItem>>).symbol" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "da39a3ee5e6b4b0d3255bfef95601890afd80709"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore._Remora_Discord_API_Gateway_Events_MessageCreate_MessageCreate_Optional_Snowflake___Optional_Remora_Discord_API_Abstractions_Objects_IPartialGuildMember___System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IUserMention___Snowflake__Snowflake__Remora_Discord_API_Abstractions_Objects_IUser__string__System_DateTimeOffset__System_DateTimeOffset___bool__bool__System_Collections_Generic_IReadOnlyList_Snowflake___Optional_System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IChannelMention____System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IAttachment___System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IEmbed___Optional_System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IReaction____Optional_string___bool__Optional_Snowflake___MessageType__Optional_Remora_Discord_API_Abstractions_Objects_IMessageActivity___Optional_Remora_Discord_API_Abstractions_Objects_IPartialApplication___Optional_Snowflake___Optional_Remora_Discord_API_Abstractions_Objects_IMessageReference___Optional_MessageFlags___Optional_Remora_Discord_API_Abstractions_Objects_IMessage____Optional_Remora_Discord_API_Abstractions_Objects_IMessageInteraction___Optional_Remora_Discord_API_Abstractions_Objects_IChannel___Optional_System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IMessageComponent____Optional_System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IStickerItem____symbol), @"mvc.1.0.view", @"/Remora.Discord.API.Gateway.Events.MessageCreate.MessageCreate(Optional<Snowflake>, Optional<Remora.Discord.API.Abstractions.Objects.IPartialGuildMember>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IUserMention>, Snowflake, Snowflake, Remora.Discord.API.Abstractions.Objects.IUser, string, System.DateTimeOffset, System.DateTimeOffset?, bool, bool, System.Collections.Generic.IReadOnlyList<Snowflake>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IChannelMention>>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IAttachment>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IEmbed>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IReaction>>, Optional<string>, bool, Optional<Snowflake>, MessageType, Optional<Remora.Discord.API.Abstractions.Objects.IMessageActivity>, Optional<Remora.Discord.API.Abstractions.Objects.IPartialApplication>, Optional<Snowflake>, Optional<Remora.Discord.API.Abstractions.Objects.IMessageReference>, Optional<MessageFlags>, Optional<Remora.Discord.API.Abstractions.Objects.IMessage?>, Optional<Remora.Discord.API.Abstractions.Objects.IMessageInteraction>, Optional<Remora.Discord.API.Abstractions.Objects.IChannel>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IMessageComponent>>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IStickerItem>>).symbol")]
namespace AspNetCore
{
#line hidden
using Statiq.Core;
using Statiq.Web.Aws;
using Statiq.Feeds.Syndication.Atom;
using Statiq.Yaml.Dynamic;
using Microsoft.Extensions.Logging.Console;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging.Debug;
using Statiq.Images;
using Statiq.Feeds.Syndication.Extensions;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Http;
using Microsoft.Extensions.FileSystemGlobbing.Internal.Patterns;
using Statiq.YouTube;
using Microsoft.Extensions.Configuration.EnvironmentVariables;
using Statiq.Xmp;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Configuration.CommandLine;
using Microsoft.Extensions.Primitives;
using Microsoft.Extensions.FileProviders.Embedded;
using Microsoft.Extensions.Http.Logging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Configuration;
using Statiq.Web.Modules;
using Microsoft.Extensions.FileSystemGlobbing.Internal;
using Microsoft.Extensions.Configuration.UserSecrets;
using Microsoft.Extensions.FileSystemGlobbing.Abstractions;
using Statiq.Testing.JavaScript;
using Statiq.Lunr;
using Statiq.Feeds.Syndication;
using Statiq.Feeds.Syndication.Rdf;
using Microsoft.Extensions.FileProviders.Internal;
using Statiq.Feeds;
using Statiq.Sass;
using Microsoft.Extensions.FileProviders.Composite;
using Statiq.Highlight;
using Statiq.Yaml;
using Microsoft.Extensions.Configuration.Ini;
using Microsoft.Extensions.Logging.TraceSource;
using Statiq.Scriban;
using Statiq.Web.Hosting;
using Microsoft.Extensions.FileSystemGlobbing.Internal.PathSegments;
using Microsoft.Extensions.DependencyModel;
using Statiq.Testing;
using Microsoft.Extensions.ObjectPool;
using Statiq.Tables;
using Microsoft.Extensions.FileProviders.Physical;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Statiq.Web.GitHub;
using Microsoft.Extensions.Hosting.Internal;
using Statiq.Docs.Pipelines;
using Microsoft.Extensions.FileProviders;
using Statiq.Less;
using Statiq.App;
using Statiq.Feeds.Syndication.Rss;
using Statiq.Web.Azure;
using Microsoft.Extensions.Configuration.Xml;
using Microsoft.Extensions.FileSystemGlobbing.Internal.PatternContexts;
using Statiq.Minification;
using Microsoft.Extensions.Caching.Memory;
using Statiq.Web.Netlify;
using Microsoft.Extensions.Configuration.Json;
using Microsoft.Extensions.Logging.EventSource;
using Microsoft.Extensions.WebEncoders.Testing;
using Microsoft.Extensions.Logging.EventLog;
using Statiq.Handlebars;
using Microsoft.Extensions.WebEncoders;
using Statiq.Html;
using Statiq.Markdown;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.DependencyModel.Resolution;
using Microsoft.Extensions.Configuration.KeyPerFile;
using Statiq.Web.Shortcodes;
using Microsoft.Extensions.Logging.Configuration;
using Microsoft.Extensions.Configuration.Memory;
using Statiq.Web.Commands;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
#nullable restore
#line 1 "_ViewImports.cshtml"
using Statiq.CodeAnalysis;
#line default
#line hidden
#nullable disable
#nullable restore
#line 2 "_ViewImports.cshtml"
using Statiq.Common;
#line default
#line hidden
#nullable disable
#nullable restore
#line 3 "_ViewImports.cshtml"
using Statiq.Docs;
#line default
#line hidden
#nullable disable
#nullable restore
#line 4 "_ViewImports.cshtml"
using Statiq.Razor;
#line default
#line hidden
#nullable disable
#nullable restore
#line 5 "_ViewImports.cshtml"
using Statiq.Web;
#line default
#line hidden
#nullable disable
#nullable restore
#line 6 "_ViewImports.cshtml"
using Statiq.Web.Pipelines;
#line default
#line hidden
#nullable disable
#nullable restore
#line 7 "_ViewImports.cshtml"
using Docable;
#line default
#line hidden
#nullable disable
#nullable restore
#line 8 "_ViewImports.cshtml"
using Microsoft.Extensions.Logging;
#line default
#line hidden
#nullable disable
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"da39a3ee5e6b4b0d3255bfef95601890afd80709", @"/Remora.Discord.API.Gateway.Events.MessageCreate.MessageCreate(Optional<Snowflake>, Optional<Remora.Discord.API.Abstractions.Objects.IPartialGuildMember>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IUserMention>, Snowflake, Snowflake, Remora.Discord.API.Abstractions.Objects.IUser, string, System.DateTimeOffset, System.DateTimeOffset?, bool, bool, System.Collections.Generic.IReadOnlyList<Snowflake>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IChannelMention>>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IAttachment>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IEmbed>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IReaction>>, Optional<string>, bool, Optional<Snowflake>, MessageType, Optional<Remora.Discord.API.Abstractions.Objects.IMessageActivity>, Optional<Remora.Discord.API.Abstractions.Objects.IPartialApplication>, Optional<Snowflake>, Optional<Remora.Discord.API.Abstractions.Objects.IMessageReference>, Optional<MessageFlags>, Optional<Remora.Discord.API.Abstractions.Objects.IMessage?>, Optional<Remora.Discord.API.Abstractions.Objects.IMessageInteraction>, Optional<Remora.Discord.API.Abstractions.Objects.IChannel>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IMessageComponent>>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IStickerItem>>).symbol")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"390a91131d365c3ba71c83bca03108793ae7c848", @"/_ViewImports.cshtml")]
public class _Remora_Discord_API_Gateway_Events_MessageCreate_MessageCreate_Optional_Snowflake___Optional_Remora_Discord_API_Abstractions_Objects_IPartialGuildMember___System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IUserMention___Snowflake__Snowflake__Remora_Discord_API_Abstractions_Objects_IUser__string__System_DateTimeOffset__System_DateTimeOffset___bool__bool__System_Collections_Generic_IReadOnlyList_Snowflake___Optional_System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IChannelMention____System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IAttachment___System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IEmbed___Optional_System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IReaction____Optional_string___bool__Optional_Snowflake___MessageType__Optional_Remora_Discord_API_Abstractions_Objects_IMessageActivity___Optional_Remora_Discord_API_Abstractions_Objects_IPartialApplication___Optional_Snowflake___Optional_Remora_Discord_API_Abstractions_Objects_IMessageReference___Optional_MessageFlags___Optional_Remora_Discord_API_Abstractions_Objects_IMessage____Optional_Remora_Discord_API_Abstractions_Objects_IMessageInteraction___Optional_Remora_Discord_API_Abstractions_Objects_IChannel___Optional_System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IMessageComponent____Optional_System_Collections_Generic_IReadOnlyList_Remora_Discord_API_Abstractions_Objects_IStickerItem____symbol : StatiqRazorPage<IDocument>
{
#pragma warning disable 1998
public async override global::System.Threading.Tasks.Task ExecuteAsync()
{
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}
#pragma warning restore 1591
So it's the C# compiler that's complaining (and rightly so). The challenge will be shortening the name in a way that won't create conflicts for other, similarly named generated classes. I'll need to think about how to do that, but once I've figured out the strategy it shouldn't take long to fix.
Timeline-wise I'm away again next week without connectivity, so it'll probably be the week after I get this patched and a new version deployed. Sit tight - it's still on my radar and I haven't forgotten.
...and I finally have a solution! This turned out to be a lot trickier than I expected. I ended up generating source document names that use a combination of qualified symbol name (without parameters) combined with symbol ID for uniqueness (which has the nice property of lining up with the output destination IDs used so you can map back to the source document if you really need to).
For example:
OLD: Remora.Discord.API.Gateway.Events.MessageCreate.Mentions.symbol
NEW: Remora.Discord.API.Gateway.Events.MessageCreate.Mentions_F9499B50.symbol
OLD: Remora.Discord.API.Gateway.Events.MessageCreate.GuildID.symbol
NEW: Remora.Discord.API.Gateway.Events.MessageCreate.GuildID_3192C401.symbol
OLD: Remora.Discord.API.Gateway.Events.MessageCreate.Content.symbol
NEW: Remora.Discord.API.Gateway.Events.MessageCreate.Content_41DC958D.symbol
OLD: Remora.Discord.API.Gateway.Events.MessageCreate.MessageCreate(Optional<Snowflake>, Optional<Remora.Discord.API.Abstractions.Objects.IPartialGuildMember>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IUserMention>, Snowflake, Snowflake
, Remora.Discord.API.Abstractions.Objects.IUser, string, System.DateTimeOffset, System.DateTimeOffset?, bool, bool, System.Collections.Generic.IReadOnlyList<Snowflake>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IChannelMention>>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Object
s.IAttachment>, System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IEmbed>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IReaction>>, Optional<string>, bool, Optional<Snowflake>, MessageType, Optional<Remora.Discord.API.Abstractions.Objects.IMessageActivity>, Optional<Remora.Discor
d.API.Abstractions.Objects.IPartialApplication>, Optional<Snowflake>, Optional<Remora.Discord.API.Abstractions.Objects.IMessageReference>, Optional<MessageFlags>, Optional<Remora.Discord.API.Abstractions.Objects.IMessage?>, Optional<Remora.Discord.API.Abstractions.Objects.IMessageInteraction>, Optional<Remora.Discord.API.Abstractions.Objects.IChannel>, Op
tional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IMessageComponent>>, Optional<System.Collections.Generic.IReadOnlyList<Remora.Discord.API.Abstractions.Objects.IStickerItem>>).symbol
NEW: Remora.Discord.API.Gateway.Events.MessageCreate.MessageCreate_46302AE4.symbol
Going to try and get a couple more fixes in the next release, will be published to NuGet sometime this week.
Thank you for addressing that issue. I'm looking forward to see the next release.
I was trying to migrate the Remora.Discord docs from Wyam to Statiq Docs, but on the way I encountered following error:
I have just created a project with the minimal set of files to reproduce the error. It can be found here: https://github.com/MazeXP/StatiqErrorReprod
The file that is causing that error is: MessageCreate.cs
I was able to analyze it to the point that the symbols name is too long for Razor: