I have a Xamarin Android app that compiles and runs fine in DEBUG mode but won't compile in RELEASE mode.
The error that I'm getting is:
Mono.Linker.MarkException: Error processing method: 'System.String Microsoft.CodeAnalysis.SQLite.Interop.NativeMethods::sqlite3_errmsg(Microsoft.CodeAnalysis.SQLite.Interop.SafeSqliteHandle)' in assembly: 'Microsoft.CodeAnalysis.Workspaces.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.String SQLitePCL.raw::sqlite3_errmsg(SQLitePCL.sqlite3)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Xamarin.Android.Tasks.AndroidTask.Execute() MedLemnMobile.Android C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets 366
I've tried "Skip Linking" for Microsoft.CodeAnalysis.Workspaces.dll
I've tried "Skip Linking" for SQLitePCLRaw.core
Neither of the above tries at "Skip Linking" fixed the problem.
The app compiles fine if I set Linking to "None", but that is not recommended for RELEASE mode.
Any help would be greatly appreciated.
2/22/2021 - I turned up the verbosity on the Build Output and did a search for System.String. Here's what I found:
Activator call 'System.Object System.Reflection.Assembly::CreateInstance(System.String)' inside 'System.ValueTuple`2<System.Int32,System.Reflection.MethodInfo> CompilerClassLibNETStandard.Compiler::CompileInMemory(System.String)' is not yet supported (TaskId:466)
5> Reflection call 'System.Reflection.FieldInfo System.Type::GetField(System.String,System.Reflection.BindingFlags)' inside 'Xamarin.Forms.BindableProperty Xamarin.Forms.VisualElement::Xamarin.Forms.StyleSheets.IStylable.GetProperty(System.String,System.Boolean)' was detected with argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Void MedLemnMobile.ViewModels.GraphViewModel::MethodBeginModeReduce(System.String)' was detected with type name `MedLemnMobile.Classes.` which can't be resolved. (TaskId:466)
5> Activator call 'System.Object System.Activator::CreateInstance(System.Type)' inside 'System.Void MedLemnMobile.ViewModels.GraphViewModel::MethodBeginModeReduce(System.String)' was detected with 1st argument expression which cannot be analyzed (TaskId:466)
5> Expression call 'System.Linq.Expressions.MemberExpression System.Linq.Expressions.Expression::Property(System.Linq.Expressions.Expression,System.Reflection.MethodInfo)' inside 'System.Void MedLemnMobile.ValidRules.ValidatableObject`1::set_IsValid(System.Boolean)' was detected with 2nd argument which cannot be analyzed (TaskId:466)
5> Expression call 'System.Linq.Expressions.MemberExpression System.Linq.Expressions.Expression::Property(System.Linq.Expressions.Expression,System.Reflection.MethodInfo)' inside 'System.Void MedLemnMobile.ValidRules.ValidatableObject`1::a(System.Collections.Generic.List`1<System.String>)' was detected with 2nd argument which cannot be analyzed (TaskId:466)
5> Expression call 'System.Linq.Expressions.MemberExpression System.Linq.Expressions.Expression::Property(System.Linq.Expressions.Expression,System.Reflection.MethodInfo)' inside 'System.Void MedLemnMobile.ValidRules.ValidatableObject`1::set_Value(T)' was detected with 2nd argument which cannot be analyzed (TaskId:466)
5> Activator call 'System.Object System.Activator::CreateInstance(System.Type,System.Object[])' inside 'System.Void MedLemnMobile.Classes.Utils/a::MoveNext()' was detected with 1st argument expression which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Object Xamarin.Forms.BindablePropertyConverter::ConvertFromInvariantString(System.String)' was detected with type name `Xamarin.Forms.` which can't be resolved. (TaskId:466)
5> Expression call 'System.Linq.Expressions.MethodCallExpression System.Linq.Expressions.Expression::Call(System.Linq.Expressions.Expression,System.Reflection.MethodInfo,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)' inside 'System.Void MedLemnMobile.Behaviors.EventToCommandBehavior::a(System.Reflection.EventInfo,System.Object,System.Action`2<System.Object,System.EventArgs>)' was detected with 1st argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Type Java.Interop.__TypeRegistrations::Lookup(System.String[],System.String)' was detected with argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Reflection.MethodInfo System.Reflection.RuntimeReflectionExtensions::GetRuntimeMethod(System.Type,System.String,System.Type[])' inside 'System.String Humanizer.EnumHumanizeExtensions::GetCustomDescription(System.Reflection.MemberInfo)' does not use detectable instance type extraction (TaskId:466)
5> Reflection call 'System.Reflection.MethodInfo System.Reflection.RuntimeReflectionExtensions::GetRuntimeMethod(System.Type,System.String,System.Type[])' inside 'System.String Humanizer.EnumHumanizeExtensions::GetCustomDescription(System.Reflection.MemberInfo)' does not use detectable instance type extraction (TaskId:466)
5> Reflection call 'System.Reflection.FieldInfo System.Type::GetField(System.String,System.Reflection.BindingFlags)' inside 'System.Void Microsoft.CodeAnalysis.CSharp.Shared.Lightup.NullableSyntaxAnnotationEx::.cctor()' does not use detectable instance type extraction (TaskId:466)
5> Reflection call 'System.Reflection.FieldInfo System.Type::GetField(System.String,System.Reflection.BindingFlags)' inside 'System.Void Microsoft.CodeAnalysis.CSharp.Shared.Lightup.NullableSyntaxAnnotationEx::.cctor()' does not use detectable instance type extraction (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String,System.Boolean)' inside 'System.Type Roslyn.Utilities.ReflectionUtilities::TryGetType(System.String)' was detected with argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Boolean Roslyn.Utilities.UICultureUtilities::TryGetCurrentUICultureSetter(System.Action`1<System.Globalization.CultureInfo>&)' was detected with type name `System.Globalization.CultureInfo, System.Globalization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a` which can't be resolved. (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Type Roslyn.Utilities.ObjectReader::ReadType()' was detected with argument which cannot be analyzed (TaskId:466)
5> Activator call 'System.Object System.Activator::CreateInstance(System.Type)' inside 'System.Object Microsoft.DiaSymReader.SymUnmanagedFactory::CreateObject(System.Boolean,System.Boolean,System.Boolean,System.String&,System.Exception&)' was detected with 1st argument expression which cannot be analyzed (TaskId:466)
5> Activator call 'T System.Activator::CreateInstance()' inside 'T Microsoft.CodeAnalysis.DecodeWellKnownAttributeArguments`3::GetOrCreateData()' is not supported (TaskId:466)
5> Activator call 'T System.Activator::CreateInstance()' inside 'T Microsoft.CodeAnalysis.EarlyDecodeWellKnownAttributeArguments`4::GetOrCreateData()' is not supported (TaskId:466)
5> Activator call 'T System.Activator::CreateInstance()' inside 'System.Void Microsoft.CodeAnalysis.Diagnostics.AnalysisState/BlockAnalyzerStateData`2::.ctor()' is not supported (TaskId:466)
5> Activator call 'System.Object System.Activator::CreateInstance(System.Type)' inside 'System.Collections.Immutable.ImmutableArray`1<TExtension> Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference/Extensions`1::GetAnalyzersForTypeNames(System.Reflection.Assembly,System.Collections.Generic.IEnumerable`1<System.String>,System.Boolean&)' was detected with 1st argument expression which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Type Roslyn.Utilities.ObjectReader::ReadType()' was detected with argument which cannot be analyzed (TaskId:466)
5> Reflection call 'System.Type System.Type::GetType(System.String,System.Boolean)' inside 'System.Type Roslyn.Utilities.ReflectionUtilities::TryGetType(System.String)' was detected with argument which cannot be analyzed (TaskId:466)
5> Activator call 'T System.Activator::CreateInstance()' inside 'System.Void Roslyn.Utilities.IDictionaryExtensions::MultiAdd(System.Collections.Generic.IDictionary`2<TKey,TCollection>,TKey,TValue)' is not supported (TaskId:466)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: Mono.Linker.MarkException: Error processing method: 'System.String Microsoft.CodeAnalysis.SQLite.Interop.NativeMethods::sqlite3_errmsg(Microsoft.CodeAnalysis.SQLite.Interop.SafeSqliteHandle)' in assembly: 'Microsoft.CodeAnalysis.Workspaces.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.String SQLitePCL.raw::sqlite3_errmsg(SQLitePCL.sqlite3)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessQueue()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: --- End of inner exception stack trace ---
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessQueue()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.Process()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Pipeline.Process(LinkContext context)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Xamarin.Android.Tasks.AndroidTask.Execute()
5>Done executing task "LinkAssemblies" -- FAILED. (TaskId:466)
5>Done building target "_LinkAssembliesShrink" in project "MedLemnMobile.Android.csproj" -- FAILED.: (TargetId:492)
SUCCESS! I got it to work as follows:
1.) I discovered that setting Linking to "Sdk and User Assemblies" got the app to build OK, but then, when it ran, the user interface didn't behave well.
2.) So then, I added to my "Skip Linking" list, the name of my main Xamarin.Forms shared-code project.
And, thank goodness, that got it to build and run cleanly!
I tried clearing bin and obj, did many things and no help. In the end I turned off the "Multi-Dex" in my Android Property for it to compile. Below are my settings.
Related
we observed strange compile errors when including files from OpenCV and spdlog in a Visual Studio 2017 project that uses conformance mode (/permissive-):
Build started...
1>------ Build started: Project: test, Configuration: Debug x64 ------
1>main.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\algorithm(5386): error C2676: binary '<': 'const _Ty' does not define this operator or a conversion to a type acceptable to the predefined operator
1> with
1> [
1> _Ty=std::chrono::duration<std::chrono::system_clock::rep,std::chrono::system_clock::period>
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\algorithm(5385): note: see reference to function template instantiation 'const _Ty &std::max<std::chrono::duration<std::chrono::system_clock::rep,std::chrono::system_clock::period>>(const _Ty &,const _Ty &) noexcept(<expr>)' being compiled
1> with
1> [
1> _Ty=std::chrono::duration<std::chrono::system_clock::rep,std::chrono::system_clock::period>
1> ]
1>d:\libraries\spdlog\1.4.1\include\spdlog\details\pattern_formatter-inl.h(880): note: while compiling class template member function 'void spdlog::details::elapsed_formatter<Padder,std::chrono::seconds>::format(const spdlog::details::log_msg &,const tm &,spdlog::memory_buf_t &)'
1> with
1> [
1> Padder=spdlog::details::null_scoped_padder
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\type_traits(616): note: see reference to class template instantiation 'spdlog::details::elapsed_formatter<Padder,std::chrono::seconds>' being compiled
1> with
1> [
1> Padder=spdlog::details::null_scoped_padder
1> ]
1>d:\libraries\spdlog\1.4.1\include\spdlog\details\pattern_formatter-inl.h(1216): note: see reference to class template instantiation 'std::is_convertible<spdlog::details::elapsed_formatter<Padder,std::chrono::seconds> *,_Ty *>' being compiled
1> with
1> [
1> Padder=spdlog::details::null_scoped_padder,
1> _Ty=spdlog::details::flag_formatter
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\algorithm(5386): note: see reference to variable template 'const bool conjunction_v<std::negation<std::is_array<spdlog::details::elapsed_formatter<spdlog::details::null_scoped_padder,std::chrono::duration<__int64,std::ratio<1,1> > > > >,std::is_convertible<spdlog::details::elapsed_formatter<spdlog::details::null_scoped_padder,std::chrono::duration<__int64,std::ratio<1,1> > > *,spdlog::details::flag_formatter *>,std::is_convertible<std::default_delete<spdlog::details::elapsed_formatter<spdlog::details::null_scoped_padder,std::chrono::duration<__int64,std::ratio<1,1> > > >,std::default_delete<spdlog::details::flag_formatter> > >' being compiled
1>d:\libraries\spdlog\1.4.1\include\spdlog\details\pattern_formatter-inl.h(1295): note: see reference to function template instantiation 'void spdlog::pattern_formatter::handle_flag_<spdlog::details::null_scoped_padder>(char,spdlog::details::padding_info)' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\algorithm(5386): error C2056: illegal expression
1>Done building project "test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The file that produced the errors is just:
#include <spdlog/spdlog.h>
#include <opencv2/opencv.hpp>
int main(int argc, char** argv)
{
return 0;
}
Changing the include order did not resolve the problem but the errors disappear when we use the 2019 compiler or when we enable the conformance mode. Switching to a newer compiler is not an option and i would like to keep conformance mode enabled.
Do you know what could be the causes of the problem and how to fix it?
Tested with (all share the issue):
spdlog: 1.4.1, 1.10.0
OpenCV: 4.0.1, 4.6.0
I have a struct in a DLL which, so far, has been used within that DLL, only.
I wanted to use the struct in another DLL, via pointer. So, I added __declspec(dllexport) to the struct definition. Simply adding that dll export statement is now causing the struct to fail to compile (not just the regular DLL export warnings). This is the first time that I've seen this behavior. I'm using Visual Studio 2019. I don't know what the underlying problem is.
What could be a reason that simply adding '__declspec(dllexport)' to a struct/class would make it fail compilation?
struct __declspec(dllexport) PipelineManager {
// ...
private:
std::unordered_map<std::string, std::string> mPathToName;
std::unordered_map<std::string, vko::PipelineLayout> mLayouts;
std::unordered_map<std::string, vko::GraphicsPipeline> mPipelines;
std::unordered_map<std::string, std::unique_ptr<GraphicsPipelineDef>> mDefs;
};
A chunk of the errors are below:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: 'std::pair<const _Kty,_Ty>::pair(const std::pair<const _Kty,_Ty> &)': attempting to reference a deleted function
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: with
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: [
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: _Kty=std::string,
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: _Ty=std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<ngen::rendo::GraphicsPipelineDef>>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\xmemory0(820,1): error C2280: ] (compiling source file Z:\NGEN\Source\Renderer\GpuProgramManager.cpp)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : see declaration of 'std::pair<const _Kty,_Ty>::pair'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : with
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : [
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : _Kty=std::string,
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : _Ty=std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<ngen::rendo::GraphicsPipelineDef>>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133): message : ] (compiling source file Z:\NGEN\Source\Renderer\GpuProgramManager.cpp)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : 'std::pair<const _Kty,_Ty>::pair(const std::pair<const _Kty,_Ty> &)': function was implicitly deleted because a data member invokes a deleted or inaccessible function 'std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : with
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : [
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : _Kty=std::string,
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : _Ty=std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<ngen::rendo::GraphicsPipelineDef>>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : and
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : [
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : _Ty=ngen::rendo::GraphicsPipelineDef
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.21.27619\include\utility(133,5): message : ] (compiling source file Z:\NGEN\Source\Renderer\GpuProgramManager.cpp)
// ...
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : see reference to function template instantiation 'std::unordered_map<std::string,std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<_Ty>>,std::hash<_Kty>,std::equal_to<_Kty>,std::allocator<std::pair<const _Kty,std::unique_ptr<_Ty,std::default_delete<_Ty>>>>>::unordered_map(const std::unordered_map<_Kty,std::unique_ptr<_Ty,std::default_delete<_Ty>>,std::hash<_Kty>,std::equal_to<_Kty>,std::allocator<std::pair<const _Kty,std::unique_ptr<_Ty,std::default_delete<_Ty>>>>> &)' being compiled
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : with
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : [
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : _Ty=ngen::rendo::GraphicsPipelineDef,
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : _Kty=std::string
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(67): message : ] (compiling source file Z:\NGEN\Source\Renderer\GpuVM.cpp)
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : see reference to class template instantiation 'std::unordered_map<std::string,std::unique_ptr<ngen::rendo::GraphicsPipelineDef,std::default_delete<_Ty>>,std::hash<_Kty>,std::equal_to<_Kty>,std::allocator<std::pair<const _Kty,std::unique_ptr<_Ty,std::default_delete<_Ty>>>>>' being compiled
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : with
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : [
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : _Ty=ngen::rendo::GraphicsPipelineDef,
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : _Kty=std::string
1>Z:\NGEN\Source\Renderer/PipelineManager.hpp(66): message : ] (compiling source file Z:\NGEN\Source\Renderer\GpuVM.cpp)
All those questions contains answers and code which parses and splits std::string and not std::wstring.
When I'm trying to attempt such conversion I got following:
std::wstring sql;
std::wistringstream str( sql );
std::wstring s;
while( std::getline( str, s, ',' ) )
{
}
error C2780: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : expects 2 arguments - 3 provided
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(479) : see declaration of 'std::getline'
error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::wistringstream'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(468) : see declaration of 'std::getline'
error C2782: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : template parameter '_Elem' is ambiguous
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(468) : see declaration of 'std::getline'
1> could be 'char'
1> or 'wchar_t'
error C2780: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : expects 2 arguments - 3 provided
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(448) : see declaration of 'std::getline'
error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::wistringstream'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(395) : see declaration of 'std::getline'
error C2782: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : template parameter '_Elem' is ambiguous
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(395) : see declaration of 'std::getline'
1> could be 'char'
1> or 'wchar_t'
fatal error C1903: unable to recover from previous error(s); stopping compilation
This is with MSVC 2010.
As I said in the beginning - THIS IS NOT A DUPLICATE. This question is explicitly about std::wstring and not std::string.
What am I doing wrong?
TIA!!
The following line:
let system = System.create "MyActorSystem" <| Configuration.load ()
... produces this output in the F# Interactive window:
Binding session to 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll'...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'Newtonsoft.Json.Converters.DiscriminatedUnionConverter' from assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.
at Akka.Serialization.NewtonSoftJsonSerializer..ctor(ExtendedActorSystem system)
--- End of inner exception stack trace ---
In my project references, Newtonsoft.Json points to .\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll. I've read that I need version 7 or above of Newtonsoft.Json for Akka.NET, so I'm not sure why I'm seeing binding for version 4.5 in the FSI output; is that a false correlation that I should just ignore?
I thought that another copy of the library file might be loading, so in C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\FsiAnyCPU.exe.config, I added:
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.1.0" />
... but then I just get error FS0192: internal error: convMethodRef: could not bind to method in FSI.
I've tried looking in the fusion logs; binding succeeds for the Newtonsoft.Json library, so nothing fishy going on, there.
Anyone else run into this problem?
EDIT: OK so I discovered in the fusion logs that another copy of Newtonsoft.Json.dll, in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\, was intercepting binding. How do I prevent this without simply removing the library file from the Blend folder?
I think your problem is that your not loading the Json.NET from your packages folder:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll
write at the top of the script
#I __SOURCE_DIRECTORY__
this will add the source directory on the probing paths.
your references should resolve correctly.
I've tried using a Java Binding Library in order to use MultiImageChooser (https://github.com/derosa/MultiImageChooser).
These are the steps I've taken :
Loaded the MultiImageChooser project in eclipse and exported a gallery.jar.
Created a Java Binding Library project in my solution, in Visual Studio.
Added gallery.jar to "Jars" and changed its type to "EmbeddedJar".
Added the reference jars (universal-image-loader-1.8.0.jar and android-support-v4.jar) and changed their type to "EmbeddedReferenceJar".
Added to Metadata.xml a transform in order to pass compilation (covariant return type) :
attr
path="/api/package[#name='com.luminous.pick']/class[#name='GalleryAdapter']/method[#name='getItem']" name="managedReturn">
Java.Lang.Object
/attr
It passes compliation, but the BuildApk task fails with System.ArgumentException : An item with the same key has already been added.
(_BuildApkFastDev target) ->
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: The "BuildApk" task failed unexpectedly. [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: System.ArgumentException: An item with the same key has already been added. [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: at Ionic.Zip.ZipFile.InternalAddEntry(ZipEntry ze) [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: at Ionic.Zip.ZipFile.AddEntry(String entryName, Stream stream) [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: at Ionic.Zip.ZipFile.AddEntry(String entryName, Byte[] byteContent) [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: at Xamarin.Android.Tasks.BuildApk.Execute() [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1132,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d_20.MoveNext() [C:\awork\TestClientNG\TestAndroidApp\TestAndroidApp.csproj]
Any idea how to debug or continue with this?
Good thing you listed the exact steps you performed, I was stuck with the same issue and was breaking my head all night.
The problem has to do with the jar you built in eclipse. When exporting to jar make sure to uncheck all the additional project files like .classpath, .project, pom.xml, project.properties and particularly AndroidManifest.xml. Since these made their way into the jar, there ended up being two android manifest files resulting in the error you are seeing.