Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@TheJayMann
Copy link
Contributor

Fixes #305

Currently, the compilation uses an assembly name derived from the name of the type for the page, while the assembly name for the file name is derived from the page's default route. Because these names are different, an error occurs attempting to load the assembly, which expects the compiled assembly name to match the file name.

This pull request attempts to remedy this by using the same assembly name for the file name that is currently being used for the compilation.

Copy link
Collaborator

@twsouthwick twsouthwick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I think we should be passing the assembly name in instead of assuming the typename is the right thing

@@ -73,21 +73,21 @@ private sealed class PersistedCompilation(StaticCompilationOptions options) : IC
public bool HandleExceptions => false;

Stream ICompilationStrategy.CreatePdbStream(string route, string typeName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm if this works, that seems like a coincidence. Maybe add a new parameter "assemblyName" to the ICompilationStrategy to make sure we're keeping everything in sync.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially used this method as it required the least amount of changes. I can redo it to modify CreatePdbStream and CreatePeStream to pass in an assembly name instead. At the point it is used in SystemWebCompilation.CreateCompiledPage, compilation.Assemblyname is available, so it should be simple.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good - I imagine we can simplify it later, but for now more explicit the better :)

@twsouthwick
Copy link
Collaborator

LGTM - once ci finishes, I'll merge

@twsouthwick twsouthwick enabled auto-merge (squash) May 22, 2024 18:03
@twsouthwick twsouthwick merged commit 2ade3ea into CoreWebForms:main May 22, 2024
@TheJayMann TheJayMann deleted the patch-1 branch May 22, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated assemblies for web forms have names which do not match file names

2 participants