Hi i'm a newbie in MacOS X (10.11.3) and have used so far F# in VS2015 on Win8.1
I have some questions:
1- in F# Interactive,
if i wanna say, have the list of files of the directory ~/Documents
Directory.GetFiles(#"~/Documents") doesn't work. What is the right syntax ?
if i want to do a #r xxx.dll, how do i specify rightly the path
2- same question in a source file (.fs or .fsx)
thanks
EDIT for example I get the following in F# interactive
let CD = "/Documents";;
val CD : string = "/Documents"
Directory.GetFiles(CD);;
System.IO.DirectoryNotFoundException: Directory '/Documents' not found.
at System.IO.Directory.ValidateDirectoryListing (System.String path, System.String searchPattern, System.Boolean& stop) <0x1a22580 + 0x001f8> in 0
at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) <0x1a22800 + 0x00061> in 0
at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) <0x1a21bf0 + 0x00034> in 0
at System.IO.Directory.GetFiles (System.String path) <0x1a21bb0 + 0x00027> in 0
at FSI_0031.main# () <0x73a07f0 + 0x00013> in 0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x1a7c850 + 0x000a1> in 0
Stopped due to error
I assume maybe you're using Mono/Xamarin? I don't have experience with MacOS but .NET should be available. You can access your home directory with: System.Environment.GetEnvironmentVariable("USERPROFILE") There are also other variables accessing special folders but I'm not sure how windows specific is that. For your second question you can use #I #"path/to/dll" to specify the folder where the dll is and then add the dll name with #r #"file.dll". This works in both fs and fsx files. You might want put this in between #if INTERACTIVE #endif block. And for compiled stuff you can add the reference to the DLL in your IDE directly.
Related
Hi!
This is not the duplicate of another question. I have attached the log. I have used the Windows Bridge ~2 years. I need an advanced answer. The StackOverflow has many talented windows developers even from Microsoft. Windows Bridge does not make a cleanup correctly and fails. It would be a bug in this technology.
Hi!
Could someone answer my question, please?
The Windows Bridge does not create a correct output.
It looks that it removes something from the folder, but it cannot.
I disabled the AV, the result is unsucceesful.
What would I do?
VERBOSE: An error occurred converting your application. Here is the full error record:
VERBOSE:
PowerShell Error Record:
Cannot remove item C:\DesktopAppConverter\21c0f04c-4eea-4f98-912b-9a47a3b0a91c\shared: Proces nie może uzyskać dostępu
do pliku „C:\DesktopAppConverter\21c0f04c-4eea-4f98-912b-9a47a3b0a91c\shared”, ponieważ jest on używany przez inny
proces.
PowerShell Stack Trace:
at Invoke-IsolatedInstall, C:\Program
Files\WindowsApps\Microsoft.DesktopAppConverter_2.1.1.0_x64__8wekyb3d8bbwe\converter_util\IsolatedEnvironmentOps.ps1:
line 221
at <ScriptBlock><Process>, C:\Program
Files\WindowsApps\Microsoft.DesktopAppConverter_2.1.1.0_x64__8wekyb3d8bbwe\DesktopAppConverter.ps1: line 679
at <ScriptBlock>, <No file>: line 1
Inner Exception[0]:
System.IO.IOException: Proces nie może uzyskać dostępu do pliku
„C:\DesktopAppConverter\21c0f04c-4eea-4f98-912b-9a47a3b0a91c\shared”, ponieważ jest on używany przez inny proces.
w System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
w System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean
throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
w System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
w Microsoft.PowerShell.Commands.FileSystemProvider.RemoveFileSystemItem(FileSystemInfo fileSystemInfo, Boolean
force)
Inner Exception Stack Trace[0]
w System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
w System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean
throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
w System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
w Microsoft.PowerShell.Commands.FileSystemProvider.RemoveFileSystemItem(FileSystemInfo fileSystemInfo, Boolean
force)
VERBOSE: The full error record is saved in the logs at C:\DesktopAppConverter\21c0f04c-4eea-4f98-912b-9a47a3b0a91c\logs
C:\Program Files\WindowsApps\Microsoft.DesktopAppConverter_2.1.1.0_x64__8wekyb3d8bbwe\DesktopAppConverter.ps1 : Cannot
remove item C:\DesktopAppConverter\21c0f04c-4eea-4f98-912b-9a47a3b0a91c\shared: Proces nie może uzyskać dostępu do plik
u „C:\DesktopAppConverter\21c0f04c-4eea-4f98-912b-9a47a3b0a91c\shared”, ponieważ jest on używany przez inny proces.
At line:1 char:1
+ &'C:\Program Files\WindowsApps\Microsoft.DesktopAppConverter_2.1.1.0_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,DesktopAppConverter.ps1
I highly appreciate the answer.
After a helpful contact with Microsoft I have decided to reinstall my OS.
Now everything works fine.
I'm working on Unity app that loads asset bundles from my htdocs, one that is to run on an iPhone.
While the content acquisition works (afaik), the loading stops about halfway and Xcode spits out the following error:
Unloading 3 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 13.037000 ms
Unloading 50 unused Assets to reduce memory usage. Loaded Objects now: 733.
Total: 10.006415 ms (FindLiveObjects: 0.065750 ms CreateObjectMapping: 0.033250 ms MarkObjects: 0.951208 ms DeleteObjects: 8.955166 ms)
2016-10-26 18:34:58.882 CookieJarApp[6245:1953469] You are using download over http. Currently unity adds NSAllowsArbitraryLoads to Info.plist to simplify transition, but it will be removed soon. Please consider updating to https.
Asset bundle [ios_cookie_prefabs] loaded.
<CoLoadAssetBundle>d__20:MoveNext()
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
The file can not be loaded because it was created for another build target that is not compatible with this platform.
Please make sure to build AssetBundles using the build target platform that it is used by.
File's Build target is: 13
<CoLoadAssetBundle>d__20:MoveNext()
[ line 907]
(Filename: Line: 907)
The AssetBundle 'http://192.168.1.241:80/CookieJarApp_test/ios_cookie_prefabs' can't be loaded because it was not built with the right version or build target.
<CoLoadAssetBundle>d__20:MoveNext()
[ line 406]
(Filename: Line: 406)
NullReferenceException: A null value was found where an object instance was required.
at AssetBundleController.GetGameObject (System.String bundleID, System.String objectName) [0x00000] in <filename unknown>:0
at AssetBundleController.UnloadAll () [0x00000] in <filename unknown>:0
at Loader+<LoadPrefabs>c__AnonStorey22.<>m__15 (UnityEngine.AssetBundle bundle) [0x00000] in <filename unknown>:0
at AssetBundleController+<CoLoadAssetBundle>d__20.MoveNext () [0x00000] in <filename unknown>:0
(Filename: currently not available on il2cpp Line: -1)
However, I built the prefab (another game in itself) with iOS platform selected in Build Settings.
I've been told it's different for asset bundles, is there anything else I can try?
Here's the CoLoadAssetBundle function:
// Start a download of the given URL
WWW www = new WWW(url);
while (!www.isDone)
{
Debug.Log("[" + bundleId + "] Progress:" + www.progress * 100f + "%");
yield return null;
}
if (string.IsNullOrEmpty(www.error))
{
Debug.Log("Asset bundle [" + bundleId + "] loaded.");
m_assetBundleList.Add(new AssetBundleStruct(bundleId, www.assetBundle));
}
else
{
Debug.Log("Asset bundle [" + bundleId + "] not loaded!\n[" + www.error + "]");
}
www.Dispose();
You have to force caching to use new copy of the AssetBundle after building it for iOS.
You can do this by provide the second parameter(int version) if you are using the WWW API.
WWW.LoadFromCacheOrDownload(url, 1);
If using the UnityWebRequest API, you must provide the third parameter(uint version) to it's static constructor.
UnityWebRequest www = UnityWebRequest.GetAssetBundle(url, 0, 1);
EDIT:
With your edited question and code, you need to use the first method I mentioned in this answer. Simply replace
WWW www = new WWW(url); with WWW www = WWW.LoadFromCacheOrDownload(url, 1);
I am trying to run recorded test cases and its giving me this error :(
I am not able to understand this.
Please help.
Test Name: CodedUITestMethod1
Test FullName: CanopusCodedUITestProject.CodedUITest1.CodedUITestMethod1
Test Source: d:\CanopusDev\Main\Source\Solutions\CanopusCodedUITestProject\CodedUITest1.cs : line 30
Test Outcome: Failed
Test Duration: 0:00:23.5295373
Result Message:
Test method CanopusCodedUITestProject.CodedUITest1.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'UIA'
FrameworkId: 'Wpf'
ControlType: 'Window'
Name: 'C5K Setup'
ClassName: 'HwndWrapper'
---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
Result StackTrace:
at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IRPFPlayback.FindAllScreenElements(IScreenElement pScreenElementStart, String bstrQueryId, Object& pvarResKeys, Int32 cResKeys, Int32 nMaxDepth, Object[]& foundDescendants)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindTopLevelWindowHelper(String queryId)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindFromPartialQueryId(String queryId, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl..ctor(String queryId)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapControlNotFoundException(COMException ex, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl..ctor(String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.SearchTopLevelWindow(ISearchArgument topLevelSearchArg, String topLevelElementQueryId)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTitleUpdatedTopLevelWindow(ISearchArgument topLevelSearchArg, String queryId, IList`1 windowTitles)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTopLevelElement(Boolean useCache, Boolean useCacheOnly, ISearchArgument searchArg, IList`1 windowTitles, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(Boolean useCache, ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<Find>b__3a()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyPrivate(String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<>c__DisplayClass3e.<GetProperty>b__3d()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetProperty(String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.ALUtility.GetTechElementFromUITestControl(UITestControl uiTestControl)
at Microsoft.VisualStudio.TestTools.UITesting.ActionExecutorManager.GetActionExecutor(UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.ClickImplementation(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.<>c__DisplayClass6.<Click>b__5()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, Point relativeCoordinate)
at CanopusCodedUITestProject.UIMap.CreateConfiguration() in d:\CanopusDev\Main\Source\Solutions\CanopusCodedUITestProject\UIMap.Designer.cs:line 280
at CanopusCodedUITestProject.CodedUITest1.CodedUITestMethod1() in d:\CanopusDev\Main\Source\Solutions\CanopusCodedUITestProject\CodedUITest1.cs:line 32
Looks like the properties of the UI Component on which you recorded has changed and so it is not able to perform your recorded actions. Verify if the search properties of the component is still the same as when you recorded.
Please look at the line shown below in your stack trace:
Microsoft.VisualStudio.TestTools.UITesting.Mouse.
Click(UITestControl control, Point relativeCoordinate)
This means that the CodedUI is trying to click on a control using a specific point on the screen.
For some reason it is unable to find the control it wants to click. Maybe no button exists on this specific point.
Most probably, the screen resolution of your current display device is different from the screen resolution of the display device you used to record these tests.
I just installed Windowsazure SDK 1.5 and respective tools for Visualstudio 2010. But when i run the compute emulator it gives me the following exception:
Encountered an unexpected error The given path's format is not supported. at
System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionA
ccess access, AccessControlActions control, String[] pathListOrig, Boolean check
ForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at Microsoft.ServiceHosting.Tools.Utility.SDKPaths.get_CSRunStateDirectory()
at Microsoft.ServiceHosting.Tools.DevelopmentFabric.DevFabric..ctor()
at Microsoft.ServiceHosting.Tools.CloudServiceRun.DoActions.get_DF()
at Microsoft.ServiceHosting.Tools.CloudServiceRun.DoActions.DevFabric(DFComma
nds acts)
at Microsoft.ServiceHosting.Tools.CloudServiceRun.DoActions.ParseArguments(St
ring[] args, Boolean doActions)
at Microsoft.ServiceHosting.Tools.CloudServiceRun.DoActions.ExecuteActions(St
ring[] args).
What is the fix for this weird exception?
I fixed it. The problem was I had an environment variable that has some invalid location and when trying to parse compute emulator is failed.
I have installed mono 2.8.1 using the package installer from mono-project.com and the f sharp libs/bins from http://fsxplat.codeplex.com/releases/view/55463.
When I run fsharpi from the Terminal, I get the following back:
Microsoft (R) F# 2.0 Interactive build
2.0.0.0 Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
Failed to install ctrl-c handler - Ctrl-C handling will not be available. Error was: Exception has been thrown by the target of an invocation.
Sad times, I have tried running mono --verbose /usr/lib/fsharp/fsi.exe but I can't see anything helpful in the logs....
Method System.MulticastDelegate:Equals (object) emitted at 0x4714c78 to 0x4714d0a (code length 146) [fsi.exe]
converting method (wrapper managed-to-native) Mono.Unix.Native.Stdlib:sys_signal (int,Mono.Unix.Native.SignalHandler)
Method (wrapper managed-to-native) Mono.Unix.Native.Stdlib:sys_signal (int,Mono.Unix.Native.SignalHandler) emitted at 0x4714d10 to 0x4714d89 (code length 121) [fsi.exe]
converting method System.Reflection.TargetInvocationException:.ctor (System.Exception)
Method System.Reflection.TargetInvocationException:.ctor (System.Exception) emitted at 0x4714d90 to 0x4714dae (code length 30) [fsi.exe]
converting method System.ApplicationException:.ctor (string,System.Exception)
Method System.ApplicationException:.ctor (string,System.Exception) emitted at 0x4714dc0 to 0x4714de6 (code length 38) [fsi.exe]
converting method System.Exception:.ctor (string,System.Exception)
Method System.Exception:.ctor (string,System.Exception) emitted at 0x4714df8 to 0x4714e16 (code length 30) [fsi.exe]
converting method System.Exception:get_Message ()
Method System.Exception:get_Message () emitted at 0x4714e18 to 0x4714e52 (code length 58) [fsi.exe]
converting method FSIstrings.SR:fsiCouldNotInstallCtrlCHandler (string)
Method FSIstrings.SR:fsiCouldNotInstallCtrlCHandler (string) emitted at 0x4714e60 to 0x4714ed8 (code length 120) [fsi.exe]
converting method <StartupCode$Fsi>.$FSIstrings/fsiCouldNotInstallCtrlCHandler#222:Invoke (System.Tuple`2<string, Microsoft.FSharp.Core.PrintfFormat`5<Microsoft.FSharp.Core.FSharpFunc`2<string, string>, Microsoft.FSharp.Core.Unit, string, string, string>>)
Method <StartupCode$Fsi>.$FSIstrings/fsiCouldNotInstallCtrlCHandler#222:Invoke (System.Tuple`2<string, Microsoft.FSharp.Core.PrintfFormat`5<Microsoft.FSharp.Core.FSharpFunc`2<string, string>, Microsoft.FSharp.Core.Unit, string, string, string>>) emitted at 0x4714ed8 to 0x4714f14 (code length 60) [fsi.exe]
converting method <StartupCode$Fsi>.$FSIstrings/fsiCouldNotInstallCtrlCHandler#222-1:Invoke (string)
Method <StartupCode$Fsi>.$FSIstrings/fsiCouldNotInstallCtrlCHandler#222-1:Invoke (string) emitted at 0x4714f18 to 0x4714f35 (code length 29) [fsi.exe]
converting method System.IO.UnexceptionalStreamWriter:Write (char)
Method System.IO.UnexceptionalStreamWriter:Write (char) emitted at 0x4714f38 to 0x4714f74 (code length 60) [fsi.exe]
Failed to install ctrl-c handler - Ctrl-C handling will not be available. Error was:
Exception has been thrown by the target of an invocation.
I have also tried running with all permutations of --readline- --nologo --gui- with no success :(
Does anyone have any idea why this is happening? What is more infuriating is that this seems to only be affecting me, as a friend of mine installed it fine using the exact same install method. Could MacPorts be affecting my fsharp install?
Thanks in advance for any help!
Cheers
Jan
I bet you should go to this,
https://github.com/fsharp/fsharp
which is the F# for Mono.
The CodePlex one has significant dependency on Windows.