Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid conflicts with multiple helper classes from multiple assemblies #443

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

kzu
Copy link
Member

@kzu kzu commented Feb 18, 2025

Since we were adding the EmbeddedResource helper as a global, project-wide class, if multiple projects happened to use resources, collisions would start to arise, with no way to disambiguate.

Since the code in the helper is actually pretty straightforward and will very likely be inlined into the IL in the end anyway, we instead just add its code as part of the resource area being emitted itself. This might result in a slightly larger assembly if there are a ton of areas, but that's a somewhat unlikely scenario.

Fixes #442

Since we were adding the EmbeddedResource helper as a global, project-wide class, if multiple projects happened to use resources, collisions would start to arise, with no way to disambiguate.

Since the code in the helper is actually pretty straightforward and will very likely be inlined into the IL in the end anyway, we instead just add its code as part of the resource area being emitted itself. This might result in a slightly larger assembly if there are a ton of areas, but that's a somewhat unlikely scenario.

Fixes #442
@kzu kzu added the bug Something isn't working label Feb 18, 2025
@kzu kzu enabled auto-merge (rebase) February 18, 2025 08:23
@kzu
Copy link
Member Author

kzu commented Feb 18, 2025

32 passed 32 passed
32 passed 32 passed
32 passed 32 passed

🧪 Details on Ubuntu 24.04.1 LTS

✅ ThisAssemblyTests.ScribanTests.CanRenderModel
✅ ThisAssemblyTests.Tests.CanReadResourceFile
✅ ThisAssemblyTests.Tests.CanUseByteResource
✅ ThisAssemblyTests.Tests.CanUseConstants
✅ ThisAssemblyTests.Tests.CanUseFileConstantInvalidIdentifier
✅ ThisAssemblyTests.Tests.CanUseFileConstantLinkedFile
✅ ThisAssemblyTests.Tests.CanUseFileConstants
✅ ThisAssemblyTests.Tests.CanUseFileInvalidCharacters
✅ ThisAssemblyTests.Tests.CanUseGitBranchConstants
✅ ThisAssemblyTests.Tests.CanUseGitConstants
✅ ThisAssemblyTests.Tests.CanUseHierarchicalMetadata
✅ ThisAssemblyTests.Tests.CanUseInfo
✅ ThisAssemblyTests.Tests.CanUseInfoDescription
✅ ThisAssemblyTests.Tests.CanUseMetadata
✅ ThisAssemblyTests.Tests.CanUseMultilineProjectProperty
✅ ThisAssemblyTests.Tests.CanUseProjectFullFileContents
✅ ThisAssemblyTests.Tests.CanUseProjectProperty
✅ ThisAssemblyTests.Tests.CanUseProjectRepositoryUrl
✅ ThisAssemblyTests.Tests.CanUseSameNameDifferentExtensions
✅ ThisAssemblyTests.Tests.CanUseSemicolonsInConstant
✅ ThisAssemblyTests.Tests.CanUseStringResource
✅ ThisAssemblyTests.Tests.CanUseStringsIndexedArguments
✅ ThisAssemblyTests.Tests.CanUseStringsIndexedFormattedArguments
✅ ThisAssemblyTests.Tests.CanUseStringsNamedArguments
✅ ThisAssemblyTests.Tests.CanUseStringsNamedFormattedArguments
✅ ThisAssemblyTests.Tests.CanUseTextResource
✅ ThisAssemblyTests.Tests.CanUseTypedBoolConstant
✅ ThisAssemblyTests.Tests.CanUseTypedDoubleConstant
✅ ThisAssemblyTests.Tests.CanUseTypedInt64Constant
✅ ThisAssemblyTests.Tests.CanUseTypedIntConstant
✅ ThisAssemblyTests.Tests.CanUseTypedLongConstant
✅ ThisAssemblyTests.Tests.CanUseTypedTimeSpanStaticProp

🧪 Details on macOS Unix 14.7.2

✅ ThisAssemblyTests.ScribanTests.CanRenderModel
✅ ThisAssemblyTests.Tests.CanReadResourceFile
✅ ThisAssemblyTests.Tests.CanUseByteResource
✅ ThisAssemblyTests.Tests.CanUseConstants
✅ ThisAssemblyTests.Tests.CanUseFileConstantInvalidIdentifier
✅ ThisAssemblyTests.Tests.CanUseFileConstantLinkedFile
✅ ThisAssemblyTests.Tests.CanUseFileConstants
✅ ThisAssemblyTests.Tests.CanUseFileInvalidCharacters
✅ ThisAssemblyTests.Tests.CanUseGitBranchConstants
✅ ThisAssemblyTests.Tests.CanUseGitConstants
✅ ThisAssemblyTests.Tests.CanUseHierarchicalMetadata
✅ ThisAssemblyTests.Tests.CanUseInfo
✅ ThisAssemblyTests.Tests.CanUseInfoDescription
✅ ThisAssemblyTests.Tests.CanUseMetadata
✅ ThisAssemblyTests.Tests.CanUseMultilineProjectProperty
✅ ThisAssemblyTests.Tests.CanUseProjectFullFileContents
✅ ThisAssemblyTests.Tests.CanUseProjectProperty
✅ ThisAssemblyTests.Tests.CanUseProjectRepositoryUrl
✅ ThisAssemblyTests.Tests.CanUseSameNameDifferentExtensions
✅ ThisAssemblyTests.Tests.CanUseSemicolonsInConstant
✅ ThisAssemblyTests.Tests.CanUseStringResource
✅ ThisAssemblyTests.Tests.CanUseStringsIndexedArguments
✅ ThisAssemblyTests.Tests.CanUseStringsIndexedFormattedArguments
✅ ThisAssemblyTests.Tests.CanUseStringsNamedArguments
✅ ThisAssemblyTests.Tests.CanUseStringsNamedFormattedArguments
✅ ThisAssemblyTests.Tests.CanUseTextResource
✅ ThisAssemblyTests.Tests.CanUseTypedBoolConstant
✅ ThisAssemblyTests.Tests.CanUseTypedDoubleConstant
✅ ThisAssemblyTests.Tests.CanUseTypedInt64Constant
✅ ThisAssemblyTests.Tests.CanUseTypedIntConstant
✅ ThisAssemblyTests.Tests.CanUseTypedLongConstant
✅ ThisAssemblyTests.Tests.CanUseTypedTimeSpanStaticProp

🧪 Details on Microsoft Windows 10.0.20348

✅ ThisAssemblyTests.ScribanTests.CanRenderModel
✅ ThisAssemblyTests.Tests.CanReadResourceFile
✅ ThisAssemblyTests.Tests.CanUseByteResource
✅ ThisAssemblyTests.Tests.CanUseConstants
✅ ThisAssemblyTests.Tests.CanUseFileConstantInvalidIdentifier
✅ ThisAssemblyTests.Tests.CanUseFileConstantLinkedFile
✅ ThisAssemblyTests.Tests.CanUseFileConstants
✅ ThisAssemblyTests.Tests.CanUseFileInvalidCharacters
✅ ThisAssemblyTests.Tests.CanUseGitBranchConstants
✅ ThisAssemblyTests.Tests.CanUseGitConstants
✅ ThisAssemblyTests.Tests.CanUseHierarchicalMetadata
✅ ThisAssemblyTests.Tests.CanUseInfo
✅ ThisAssemblyTests.Tests.CanUseInfoDescription
✅ ThisAssemblyTests.Tests.CanUseMetadata
✅ ThisAssemblyTests.Tests.CanUseMultilineProjectProperty
✅ ThisAssemblyTests.Tests.CanUseProjectFullFileContents
✅ ThisAssemblyTests.Tests.CanUseProjectProperty
✅ ThisAssemblyTests.Tests.CanUseProjectRepositoryUrl
✅ ThisAssemblyTests.Tests.CanUseSameNameDifferentExtensions
✅ ThisAssemblyTests.Tests.CanUseSemicolonsInConstant
✅ ThisAssemblyTests.Tests.CanUseStringResource
✅ ThisAssemblyTests.Tests.CanUseStringsIndexedArguments
✅ ThisAssemblyTests.Tests.CanUseStringsIndexedFormattedArguments
✅ ThisAssemblyTests.Tests.CanUseStringsNamedArguments
✅ ThisAssemblyTests.Tests.CanUseStringsNamedFormattedArguments
✅ ThisAssemblyTests.Tests.CanUseTextResource
✅ ThisAssemblyTests.Tests.CanUseTypedBoolConstant
✅ ThisAssemblyTests.Tests.CanUseTypedDoubleConstant
✅ ThisAssemblyTests.Tests.CanUseTypedInt64Constant
✅ ThisAssemblyTests.Tests.CanUseTypedIntConstant
✅ ThisAssemblyTests.Tests.CanUseTypedLongConstant
✅ ThisAssemblyTests.Tests.CanUseTypedTimeSpanStaticProp

from dotnet-retest v0.6.3 on .NET 8.0.13 with 💜

@kzu kzu merged commit ad9242c into main Feb 18, 2025
11 checks passed
@kzu kzu deleted the dev/duplicate-helper branch February 18, 2025 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant