-
Notifications
You must be signed in to change notification settings - Fork 220
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
Rewrite WPF pack-URIs found in CLR strings #387
Comments
I got a POC working: public void Perform()
{
var types = _repackContext.TargetAssemblyDefinition.Modules.SelectMany(m => m.Types);
_logger.Verbose("Processing XAML resource paths ...");
foreach (var type in types)
{
PatchIComponentConnector(type);
PatchWpfToolkitVersionResourceDictionary(type);
PatchWpfPackStrings(type); // <-- Add this line
}
}
// Add this method
private void PatchWpfPackStrings(TypeDefinition type)
{
foreach (var method in type.Methods.Where(x => x.HasBody))
{
PatchMethod(method);
}
} This already is enough to find and patch all pack-uris and the application does not crash anymore but works as intended! |
Once you finalize on a solution that works for you, consider sending the PR. Unfortunately I don't have the resources to do it myself, but I could help with merging the PR and shipping an update. |
warappa
added a commit
to warappa/il-repack
that referenced
this issue
Feb 3, 2025
… adapter for tests to be discovered and run
warappa
added a commit
to warappa/il-repack
that referenced
this issue
Feb 6, 2025
warappa
added a commit
to warappa/il-repack
that referenced
this issue
Feb 7, 2025
… if pack-uris are not patched in CLR strings
warappa
added a commit
to warappa/il-repack
that referenced
this issue
Feb 7, 2025
… handled by generic pack-uri patching
warappa
added a commit
to warappa/il-repack
that referenced
this issue
Feb 9, 2025
…entationFramework assembly
KirillOsenkov
added a commit
that referenced
this issue
Feb 9, 2025
#387 Patch pack-uris in CLR strings
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue
I'm developing a WPF application which uses WPF.UI.
With the newest ILRepack version (2.0.36) the XAML/BAML rewrite works great!
But unfortunately, WPF.UI tends to use hardcoded pack-uris in its code behind files (normal CLR strings). Those are not found/detected by ILRepack.
Eg.
https://github.com/lepoco/wpfui/blob/397739b85cfa616315740a360279f301847fa59d/src/Wpf.Ui/Controls/ContextMenu/ContextMenuLoader.xaml.cs#L45-L51
Expectation
Could you try to generally detect
"pack:..."
strings and rewrite those also (so not only specific to WPF.UI)?Info
.NET Framework 4.8
ILRepack 2.0.36
WPF.UI 4.0.0-rc.3
The text was updated successfully, but these errors were encountered: