Comments (3)
While that wouldn't be the first bug it has, it'd strange I didn't see this one before.
Are you using the latest version ? Can you put up a reproduction project ?
from il-repack.
Yes, I am using the latest version.
For reproduction just try to merge an assembly with the following class:
public class Test
{
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hWnd);
}
You will see, that the [return: MarshalAs(UnmanagedType.Bool)] attribute will be stripped from the output assembly.
I fixed it in my local version like this (not sure if it is completely correct, but it works):
// class ILRepack
private void CloneTo(MethodDefinition meth, TypeDefinition type, bool typeJustCreated)
{
...
nm.ReturnType = Import(meth.ReturnType, nm);
CopyCustomAttributes(meth.MethodReturnType.CustomAttributes, nm.MethodReturnType.CustomAttributes, nm);
// BEGIN ADDED CODE
if (meth.MethodReturnType.HasConstant)
nm.MethodReturnType.Constant = meth.MethodReturnType.Constant;
if (meth.MethodReturnType.HasMarshalInfo)
nm.MethodReturnType.MarshalInfo = meth.MethodReturnType.MarshalInfo;
nm.MethodReturnType.Attributes = meth.MethodReturnType.Attributes;
// END ADDED CODE
if (meth.HasBody)
CloneTo(meth.Body, nm);
...
}
from il-repack.
Thank you!
from il-repack.
Related Issues (20)
- Error merging VB app in 2.0.27 HOT 20
- Mysterious failure in ILpacked application HOT 10
- Am I misunderstanding ILRepack / ILMerge HOT 11
- Exceptions aren't renamed? HOT 3
- ILRepacked DLL is looking for PDB files in a non-existent subfolder HOT 5
- Ability to internalize a subset of input assemblies HOT 1
- Add an Icon to the nuget package HOT 1
- Repacking Harmony in Debug mode fails HOT 15
- Disable source server warning on unix HOT 2
- Possible Internalize regression HOT 5
- Cecil binaries need to be internalized HOT 7
- Getting "Method reference is used with definition return type / parameter." / Due to TypeForwardedTo type HOT 22
- Replacement for AllowDuplicateType Method of ILMerge HOT 3
- ArgumentOutOfRange in RepackAssemblyResolver.cs:line 203 HOT 2
- TypeReference with null scope
- Metadata warnings in MashupEngine
- Read of keyfile fails on Linux
- Improve error message for when dotnet.exe can't be found HOT 3
- How to debug a merged assembly (.EXE)? HOT 30
- .Net Framework 4.7.2, XAML not working for EXE HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from il-repack.