F# - Array.Parallel module not accessible - module

I can access the Array.Parallel module in F# Interactive but not when compiling.
What might be wrong ? (VS 2010)
namespace X // not sent to interactive
open Microsoft.FSharp.Collections
module M =
let square (a _[]) = Array.map (fun a -> a*a ) // OK
let squareP (a:_[]) = Array.Parallel.map (fun a -> a*a ) // Error: "Parallel" not defined
This code compiles fine in FSI but when part of a project fails:
------ Erstellen gestartet: Projekt: DELETE TEST, Konfiguration: Debug Any CPU ------
C:\Program Files (x86)\Microsoft F#\v4.0\fsc.exe -o:obj\Debug\DELETE_TEST.dll -g --debug:full --noframework --define:DEBUG --define:TRACE --doc:bin\Debug\DELETE_TEST.XML --optimize- --tailcalls- -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v2.0\FSharp.Core.dll" -r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" -r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll --target:library --warn:3 --warnaserror:76 --vserrors --LCID:1031 --utf8output --fullpaths --flaterrors Module1.fs
C:\work\Goswin\30_F#\16-135_LAD\DELETE TEST\Module1.fs(7,37): Fehler FS0039: Der Wert, Konstruktor, Namespace oder Typ "Parallel" ist nicht definiert.

You are targeting .NET 2.0: -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v2.0\FSharp.Core.dll"
The Parallel module is implemented via System.Threading.Tasks, which were not introduced until .NET 4.0. Thus the Parallel module doesn't exist on Array in the .NET 2.0 version of FSharp.Core.dll. If you re-target to 4.0 it will work.
It works in FSI because FSI runs in a .NET 4 environment.

Related

vs2019 wxwidgets sample hello world -> "wxstrcoll not found"

Seems like many people hit this and there seems to be no solution that I can find.
Follow exact instructions, downloaded precompiled libs, v 3.0.5 - latest stable build
set wxwin env var
make new 32bit empty project
copy the hello world app into new source file
set additional include
set preproc defintions -> UNICODE & _UNICODE on
set linker libs
build ->
1>------ Build started: Project: wxtest, Configuration: Debug Win32 ------
1>Source.cpp
1>c:\work\wxwin\include\wx\wxcrt.h(487): error C3861: 'wxStrcoll': identifier not found
1>c:\work\wxwin\include\wx\wxcrt.h(487): message : 'wxStrcoll': function was not declared in the template definition context and can be found only via argument-dependent lookup in the instantiation context
1>c:\work\wxwin\include\wx\wxcrt.h(496): message : see reference to function template instantiation 'int wxStrcoll_String<const wchar_t*>(const wxString &,const T &)' being compiled
1> with
1> [
1> T=const wchar_t *
1> ]
1>Done building project "wxtest.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Unfortunately you need to manually modify the header to fix the build with MSVS 2019 in 3.0.5 and remove defined(__VISUALC__) || part of the check before wxNEEDS_DECL_BEFORE_TEMPLATE definition in wx/wxcrt.h.
FWIW this problem was fixed since a long time (~6 years) in wx 3.1 and you can compile 3.1.3 or the soon to be released 3.1.4 out of the box with MSVS 2019.

Error while Building (compile) wixproj using MSBuild api 15.9.20

I'm using wix in a project and i have a specific need :
Build wixproj using MSBuild from c#.
For that i'm using MSBuild api as folowing :
static void Main(string[] args)
{
string toolsPath = ToolLocationHelper.GetPathToBuildToolsFile("msbuild.exe", ToolLocationHelper.CurrentToolsVersion);
ProjectCollection projectCollection = new ProjectCollection();
projectCollection.AddToolset(new Toolset(ToolLocationHelper.CurrentToolsVersion, Path.GetDirectoryName(toolsPath), projectCollection, string.Empty));
Project project = projectCollection.LoadProject("TestWix.wixproj");
var result = project.Build(new ConsoleLogger());
Console.ReadKey();
}
And i get this error :
C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets(1988,5): error MSB4127: The "GenerateCompileWithObjectPath" task could not be instantiated from the assembly "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixTasks.dll". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Unable to cast object of type 'Microsoft.Tools.WindowsInstallerXml.Build.Tasks.GenerateCompileWithObjectPath' to type 'Microsoft.Build.Framework.ITask'.
But when i use msbuild command line it's work fine.
Do you have any idea please ?
Thank you in advance.

Error migrating from GeneXus 9 to GeneXus Evo 2 U5

I'm migrating a KB from GeneXus 9 to GeneXus Evo 2 U5. I'm using .Net and SQL Server, and followed the steps that are mentioned in GXTechnical but I have the following error:
========== DeveloperMenu Compilation started ==========
gxexec "C:\Modelos GX\Postulantes\DATAPROT\bldDevelopermenu.cs" -r:GxBaseBuilder.dll -arg:csc="C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe" -arg:mdlpath="C:\Modelos GX\Postulantes\DATAPROT"
Building bin\messages.spa.dll
Read in 570 resources from 'messages.spa.txt'
Writing resource file... Done.
Compilador de Microsoft (R) Visual C# 2008, versi¢n 3.5.30729.5420 para Microsoft (R) .NET Framework, versi¢n 3.5
(C) Microsoft Corporation. Reservados todos los derechos.
Error:Build error for target bin\GeneXus.Programs.Common.dll: .\GxObjectCollection.cs does not exist.
DeveloperMenu Compilation Failed
========== Assemblies Compilation started ==========
gxexec "C:\Modelos GX\Postulantes\DATAPROT\bldAssemblies.cs" -r:GxBaseBuilder.dll -arg:csc="C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe" /noconfig -arg:mdlpath="C:\Modelos GX\Postulantes\DATAPROT"
Error:Build error for target bin\GeneXus.Programs.Common.dll: .\GxObjectCollection.cs does not exist.
Assemblies Compilation Failed
Rebuild All Failed
What should I do to solve this problem?
Try these steps:
In GeneXus, go to Tools -> Explore Knowledgebase Directory
Delete all *.ari, *.0?? files
In GeneXus, go to Tools -> Explore Target Environment Directory
Delete that folder
In GeneXus, go to Build -> Rebuild All
If you keep having the same error, look at the entire output; there may be other errors before that one. If not, contact the GeneXus support team. If yes, search in google or search.genexus.com for solutions of that new errors.

How to run NUnit 3.0 with Mono 4.0 runtime?

I'm trying to run a test assembly built with .NET Framework 4.5.1 on Mono 4.0 and NUnit 3.0 on Windows.
Does anyone know how to make nunit-console.exe see the Mono 4.0 runtime that is installed on my machine and stop saying it is unknown or not available?
If I run nunit-console.exe through mono and set the target framework:
mono C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe --framework=mono-4.0 "C:\MyTestAssembly.dll"
NUnit Console Runner 3.0.5610
Copyright (C) 2014 Charlie Poole
Test Files
C:\MyTestAssembly.dll
Runtime Environment
OS Version: Microsoft Windows NT 6.3.9600.0
CLR Version: 4.0.30319.0
Options
ProcessModel: Default DomainUsage: Default
Execution Runtime: mono-4.0
Work Directory: C:\
Internal Trace: Off
The requested framework mono-4.0 is unknown or not available.
If I run nunit-console.exe directly, without mono, the output is the same:
C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe --framework=mono-4.0 "C:\MyTestAssembly.dll"
If I run nunit-console.exe through mono but without the target framework, the output changes:
mono C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe "C:\MyTestAssembly.dll"
NUnit Console Runner 3.0.5610
Copyright (C) 2014 Charlie Poole
Test Files
C:\MyTestAssembly.dll
Runtime Environment
OS Version: Microsoft Windows NT 6.3.9600.0
CLR Version: 4.0.30319.0
Options
ProcessModel: Default DomainUsage: Default
Execution Runtime: Not Specified
Work Directory: H:\Safe\Desenvolvimento\Concert\Reactive Services
Internal Trace: Off
System.ArgumentException: The mono-4.0 framework is not available
Parameter name: framework
at NUnit.Engine.Services.TestAgency.LaunchAgentProcess (NUnit.Engine.TestPackage package) [0x00000] in :0
at NUnit.Engine.Services.TestAgency.CreateRemoteAgent (NUnit.Engine.TestPackage package, Int32 waitTime) [0x00000] in
:0
at NUnit.Engine.Services.TestAgency.GetAgent (NUnit.Engine.TestPackage package, Int32 waitTime) [0x00000] in :0
at (wrapper remoting-invoke-with-check) NUnit.Engine.Services.TestAgency:GetAgent (NUnit.Engine.TestPackage,int)
at NUnit.Engine.Runners.ProcessRunner.LoadPackage () [0x00000] in :0
And finally, if I run the last option using NUnit 2.6.4, the test runs but the mono process hangs at the end.
mono C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe "C:\MyTestAssembly.dll"
And if I run without mono and the target framework using NUnit 2.6.4 or NUnit 3.0, the test runs and the process ends normally.
C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe "C:\MyTestAssembly.dll"
C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe "C:\MyTestAssembly.dll"
You have to use NUnit embedded in Mono. Execute the following commands in console:
cd C:\Program Files (x86)\Mono\bin
nunit-console4 *PATH TO YOUR .Tests.dll*

Upgrading App from .NET 3.5 to 4.0, COM fails now

I have an application that I am upgrading from the .NET 3.5 to the .NET 4.0 framework. It uses a COM library which is referenced. It works no problem in 3.5 but after converting to 4.0 I have issues getting the COM to work. The COM is from a 3rd party so we didn't develop it ourselves.
I get the following COM error (generic COM error, not specific to the COM object itself): hr = 0x8007000b
CLR gives me: 'The invocation of the constructor on type 'Skype_Business_Launcher.Main' that matches the specified binding constraints threw an exception.' Line number '3' and line position '5'.
And the C# logs:
=== Pre-bind state information ===
LOG: User = \phillip
LOG: DisplayName = Interop.SKYPE4COMLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Skype Business Launcher, Version=1.0.5.0, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file:
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///bin/Debug/Interop.SKYPE4COMLib.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
I removed the pathname for security reasons but I have checked all the path information and it's all correct. Also the COM library file exists where it's pointing to. It's also copied to the OBJ folder within the project as well.
Originally I was getting an error about the COM library not supporting embedded types so I made "Embed Interop Types" false (it was true below) and the error went away but I'm not sure if thats connected to this error or not so I thought I'd mention it just in case.
Again, it works just fine with 3.5.
Thanks,
A shot in the dark: it looks like you are using the x64 version of the framework. Was that already the case with 3.5 ? And is the COM server a DLL or an EXE ?
If the COM server is a DLL, there needs to be a "bitness" match between the DLL and your program.
when you convert your project to 4.0 the IDE can perform a issue to convert COM library into 4.0.
when you convert your project to 4.0 remove com library then Re include it in your project then i thing it should be works.