I have a UIBarButtonItem bound to a MvvmCross command:
set.Bind(this.deleteItem).To(vm => vm.DeleteCommand).CommandParameter(this.deleteItem);
This works fine with the linker turned off. But if I set it to Link SDK assemblies only, the binding breaks and never gets fired. It silently fails, no errors or logged warnings.
Removing the CommandParameter and enabling the linker does work, however:
set.Bind(this.deleteItem).To(vm => vm.DeleteCommand);
Why does the binding break when the linker is enabled? I've made sure the linker is including UIBarButtonItem.Clicked.
Figured this out: the linker was stripping ICommand's CanExecuteChanged event, which was used via reflection in MvxWrappingCommand.
The fix was to add an XML linker configuration file with this:
<assembly fullname="System">
<type fullname="System.Windows.Input.ICommand"></type>
</assembly>
Curiously adding a LinkerPleaseInclude.cs file referencing CanExecuteChanged didn't seem to preserve it, not sure why.
Related
I have a cmake project that is part of some larger environment.
There are some cmake makros/functions that I have to use to set up my project.
At some point they add a compile flag:
TARGET_COMPILE_OPTIONS (${name} PUBLIC "$<$<CONFIG:Release>:/GL>")
however, i want to remove this flag afterwards because it causes some inconvenience in my project.
But there seems to be a bug in cmake:
I tried to to remove the flags from the INTERFACE_COMPILE_OPTIONS and COMPILE_OPTIONS (this is there target_compile_options adds the options according to cmake doku ).
message commands before and after the removal shows the success but the generated vcxproj file still contains the
<WholeProgramOptimization>true</WholeProgramOptimization>
in the <ItemDefinitionGroup><ClCompile> section.
So it seems that adding the /GL flags triggers some internal state change that can not be removed afterwards. (if i remove the addition of that flag in the macro I have to call, then the WholeProgramOptimization node is not added to the vcxproj)
Did I miss something?
I can just add a /GL- as an option but then I get a lot of D9025 warnings (override /GL with /GL-)
(tested with cmake 3.15 and 3.13)
It turns out, that the problem is that the cmake scripts I have to use sets the optimizer settings with PUBLIC as scope
TARGET_COMPILE_OPTIONS (${name} PUBLIC "$<$<CONFIG:Release>:/GL>")`
^^^^^^
Another dependency of my project uses the same function and gets this flag into its INTERFACE_COMPILE_OPTIONS and my project inherits this option without possibility to remove it.
The only way seems to be to get the common scripts fixed to use PRIVATE scope instead. This would be more logical, since its an internal target property that does not have any implications to the consumer.
I have a project that is running fine on Android and WinPhone 8. When I attempt to run on iOS, I've getting the following error
Microsoft.Practices.ServiceLocation.ActivationException: Cannot
register: No public constructor found in x
where x is whatever SimpleIoc.Default.Register<T, TU>(); the flow hits first. I've moved the code around (as suggested elsewhere) to ensure all of the platform specific SimpleIoc calls are made in ViewModelLocator.
I've added public default ctors in the classes that are complaining about the error (I have though set the PreferredConstructor to the original, not the newly added public ctor).
I have a feeling that this error is a false positive (something else is failing, but pointing at that code).
Using Xam.iOS via a build server (the code is coming from VS2015). Xcode is running the 8.3 emulators (it may need updating to allow for 8.4 testing)
It could be that the Linker is optimising away the constructor, if it thinks it's not used. Try setting the Linker Options to "Don't Link" and see if it does it again, or even new-up an instance of the class elsewhere so that the Linker knows that the constructor is used. You don't necessarily want to leave it that way, but if it eliminates the error, you'll at least know the reason.
The [Preserve] attribute did the trick for me.
Decorate constructor with it and keep your linker settings.
This attribute is part of the Microsoft.WindowsAzure.MobileServices namespace.
We've updated to VS2012 recently and also changed our PostSharp version to 3.0.26. Generally this combination works fine, but I get warnings for my unit test project such as
The module "MyModule.Fakes.dll" does not contain any aspect or other transformation. For improved build-time performance, consider disabling PostSharp for this module by setting the compilation symbol (aka constant) "SkipPostSharp" in your project or set the MSBuild property "SkipPostSharp=True".
Now usually I can disable this warning by changing the project settings accordingly (SkipPostSharp = True), but I've already done that for my MyProjectTest project containing the unit tests.
When I add <SkipPostSharp>True</SkipPostSharp> to my MyModule.Fakes file in the Fakes folder, the warning about PostSharp disappears, however, I get another error message:
The element "Fakes" in namespace "http://schemas.microsoft.com/fakes/2011/" has invalid child element "SkipPostSharp" in namespace "http://schemas.microsoft.com/fakes/2011/". List of possible elements expected: "StubGeneration, ShimGeneration, Compilation" in namespace "http://schemas.microsoft.com/fakes/2011".
Update
I also tried editing the fakes.xsd file and add an extra SkipPostSharp element, but a) this still isn't recognised as a valid element by Visual Studio and b) I'm not sure whether this would be the right approach anyway.
Any ideas how to get rid of these warnings?
You can specify additional properties for the project file Fakes will generate to build the fakes assembly by placing Property elements inside of the Compilation element at the end of the .FAKES file. Here is an example based on your description.
<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/">
<Assembly Name="MyModule"/>
<Compilation>
<Property Name="SkipPostSharp">True</Property>
</Compilation>
</Fakes>
dllmain.cpp(16): warning C4447: 'main' signature found without threading mode
l. Consider using 'int main(Platform::Array<Platform::String^>^ args)'.
Above is a warning I got from building a Windows Store App DLL project. I didn't change anything in that default dllmain.cpp file except for including my own version of pch.
The documentation for this warning (along with many VS2012 errors/warnings) is nowhere to be found on MSDN and here is the only relevant link I can find:
http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/6daa9587-fe54-4e84-a8b9-0e5c52c2f6e8/
and the op there didn't get an answer.
If anyone knows what it means and how to fix it, it would be great!
As far as I can tell, you can safely ignore the warning. The compiler cribs when it sees a Win32-style DllMain being compiled using the /ZW flag (Consume Windows Runtime Extensions). However, the function gets called as you'd normally expect.
Alternatively, you can work around the warning by compiling dllmain.cpp without /ZW. You might need to adjust the PCH settings for this to properly work. This is the path taken by the DLL (Windows Store apps) C++/CX project template in Visual Studio.
Incidentally, the reason you do not get the warning when you're trying to build a Windows Runtime Component project (which builds everything using /ZW) is that a Windows Runtime Component doesn't declare a DllMain. This is not to say that it can't; it just picks up the dummy DllMain that the CRT defines (which basically turns off per-thread initialization and reports success).
I'm having a weird problem when trying to register the .dll i created using regsvr32.
During development everything went fine, the debug version registers and works fine. Now i wanted to create a Release version, but that Version does not register anymore.
regsvr32 comes up with the following error:
The module "mpegsplitter.dll" failed to load.
Make sure the binary is stored at the specified path or
debug it to check for problems with the binary or
dependent .DLL files.
The specified procedure could not be found.
Some research brought me to the dependency walker, which does tell me this
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
It also does show a dependency on "crtdll.dll" that the debug version does not have (The function view shows soem functions that normally should be in ole32.dll), which is colored red'ish.
So far so good, i guess its somehow related to what the dependency walker shows there.
But where do i go from here? How do i fix it?
Any help would be greatly appreciated, that has been keeping me busy for several hours already.
Thanks!
I have the same problem. When I compared the different between "Command Line" (in Project Properties -> Linker) of Release and Debug mode, I found out that the "Optimization" options (in Project Properties -> Linker) of Release mode was turned on while ion Debug not.
Turning of Optimization for linker in Release mode solved the problem
Is it possible that the debug version is compiled with _ATL_MIN_CRT but the release version isn't? You can set this with the Minimize CRT Use in ATL project property as well.
I fixed it. It was actually being caused by the order of some mingw libraries i included to link against ffmpeg. Oh well, how weird.
In my case, the difference was in Module Definition File entry between DEBUG and RELEASE. The DEBUG version was pointing to the .DEF file where as the RELEASE had it empty.