trying to play a .wav file in my application for a preview.
-> following code is beeing executed:
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = this.UnderlyingAudioFile.FullName;
player.Play();
Error occurs:
System.IO.FileNotFoundException: 'Please be sure a sound file exists at the specified location.'
this.UnderlyingAudioFile.FullName; Beeing a System.IO.FileInfo Object;
the path is definitely correct. I checked 3 times and can copy paste it from this.UnderlyingAudioFile.FullName;
This Error actually occurs, when the other thread cannot access the File.
in my case, I had to open the file with fileshare.read property:
this.Reader = new BinaryReader(File.Open(path,FileMode.Open,FileAccess.Read,FileShare.Read));
Related
I'm trying to use the ocaml-mm package (https://github.com/savonet/ocaml-mm) and trying to run one of the examples for sine_wav.ml
I first installed the package and also installed the ao library, which the sine_wav file uses. Everything compiles, but I get this error when I'm trying to run the file:
ddavidjeong#DESKTOP-60PESIS:~/cs3110/ms/test$ make main
Entering directory '/home/ddavidjeong/cs3110/ms'
Fatal error: exception Failure("Failed to open device")
make: *** [Makefile:2: main] Error 2
ddavidjeong#DESKTOP-60PESIS:~/cs3110/ms/test$
I have no idea what this exception could refer to.
This errors means that the libao library failed to open its default audio device. You can at least check which default device was found by the library by using in utop
#require "ao";;
Ao.get_default_driver ()
```ocaml
Similarly, you can get the list of all audio device found by libao with
```ocaml
Ao.drivers;;
If there is no visible issue with the default driver, and there is some non-default driver available that looks like they might work; it would be possible to try to use another device in sin_wave.ml by replacing the instance of the Mm_ao.writer class in
let ao = new Mm_ao.writer channels sample_rate in
by an instance of
class ao_writer driver channels rate = object
object
val dev = Ao.open_live ~driver ~channels ~rate ~byte_format:`LITTLE_ENDIAN ()
method write buf ofs len =
let s = Audio.S16LE.make buf ofs len in
Ao.play dev s
method close = Ao.close dev
end
with the right driver.
But it is probably better to see why libao cannot open the default device that it selected itself.
I am rather new to eclipse hawkbit and SWupdate I have been trying to do a test implementation on a RPi before I go with the production implementation.
I have Hawkbit up and running but I am having several problems with SWupdate, I have built a core-image-full-cmdline.wic and the .swu update Image along with it:
This is the local.conf:
MACHINE = "raspberrypi3"
IMAGE_FSTYPES += "wic"
RPI_USE_U_BOOT = "1"
KERNEL_IMAGETYPE = "uImage"
IMAGE_INSTALL_append = " kernel-image kernel-modules"
#WKS_FILES_raspberrypi3 = "ts-raspberrypi.wks"
PREFERRED_PROVIDER_u-boot-fw-utils = "libubootenv"
DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
ENABLE_UART = "1"
I also got this error when I changed the IMAGE_FSTYPE from ext4 rpimg to wic:
ERROR: update-image-1.0-r0 do_swuimage: swupdate cannot find image file: /home/aswin/yocto/build/tmp/deploy/images/raspberrypi3/core-image-full-cmdline.ext4.gz
ERROR: Logfile of failure stored in: /home/aswin/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/update-image/1.0-r0/temp/log.do_swuimage.87006
ERROR: Task (/home/aswin/yocto/layers/meta-swupdate-boards/recipes-extended/images/update-image.bb:do_swuimage) failed with exit code '1'
So I had to change the update-image.bb FSTYPE = ".wic"
And when I comment this out #WKS_FILES_raspberrypi3 = "ts-raspberrypi.wks"
Then flash the image to a sd card and boot it nothing really shows up except for a blinking line. If I leave it, then the .swu file is way too big to upload it to hawkbit.
How do you expect it to work when you have HW compatibility errors, JSON file corrupted errors, forget about the hawkbit for now, and try to see if your sw-description file is creating the correct swu image file that updates the rootsfs or whatever you want to update using mongoose webserver and only then move on to the hawkbit.
First solve the errors that are coming before
suitable .swu image not found
Edited: please also put the sw-descirption file that you are using to create your swu file for further help.
For a while now I've been getting the following OUTPUT window when building a solution:
1>------ Build started: Project: Scheduler, Configuration: Debug Any CPU ------
1> Scheduler -> C:\Users\dubilm\source\repos\scheduler\Scheduler\bin\Scheduler.dll
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4811,5): error MSB3541: Files has invalid value "<<<<<<< HEAD". Illegal characters in path.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have tried Clean and Rebuild to no avail. The application works despite the reported error and updates have been deployed to production server with no issues. None of my other solutions/projects have any issues building.
The ERROR LIST window also lists the same error...
Severity = Error
Code =
Description = Files has invalid value "<<<<<<< HEAD". Illegal characters in path.
Project = Scheduler
Path =
File =
Project Rank = 1
Line =
Column =
Category =
Source = Build
Suppression State =
Tool
So no file indicated as the source of the error. The project is a web application .net vb MVC if this has any bearing.
Any suggestions of what else I can try to clear this error. Thanks
The <<<<<<< HEAD is what you get when trying to merge files, its used to indicate where the code starts (the old and the new one) sometimes when merging, some issues happen(ther could be a ton of diferent reasons) and you get stuck with that in the middle of your code, just use the search function (Ctrl + f) and search for <<<<<<< HEAD (make sure you had the search option in "search in this solution") you will see where it is, and if there is no duplicated code around, you can just erase it
I deleted the "bin" and "obj" folders and then cleaned the solution. It worked for me. Hope this will help.
Try unloading and reloading project. That worked for me.
I have an instance of IMvxFileStore implementation for for Windows Phone injected into my service.
Let say I want to store settings in a file located at appsettings\userprofiles\profile1.txt
Using the file plugin, I first call the API EnsureFolder exists, passing in the full path to my profile settings file appsettings\userprofiles\profile1.txt to ensure that this folder has been created and does exist.
Just for sanity, I check to ensure that the folder has been created using the FolderExist API. This always returns true atleast for now.
The code looks like this:
private string GetStorageItemFileName(string filename)
{
Guard.ThrowIfNull(string.IsNullOrWhiteSpace(BaseDirectory), Messages.RepositorBackingStoreIsNull);
filename = _fileStore.PathCombine(BaseDirectory, filename);
_fileStore.EnsureFolderExists(filename);
if (_fileStore.FolderExists(filename))
{
// what do do????
}
return filename;
}
However, when I attempt to write content to the file using WriteToFile API, passing in the file name returned from the method above and some string, as follows
try
{
_fileStore.WriteFile(filename, content);
}
catch (Exception ex)
{
Logger.Error(ex);
}
, I get the following exception:
System.IO.IsolatedStorage.IsolatedStorageException was caught
HResult=-2146233264 Message=Operation not permitted on
IsolatedStorageFileStream. Source=mscorlib StackTrace:
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path,
FileMode mode, FileAccess access, FileShare share, Int32 bufferSize,
IsolatedStorageFile isf)
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path,
FileMode mode, IsolatedStorageFile isf)
at Cirrious.MvvmCross.Plugins.File.WindowsPhone.MvxIsolatedStorageFileStore.WriteFileCommon(String
path, Action`1 streamAction)
at Cirrious.MvvmCross.Plugins.File.WindowsPhone.MvxIsolatedStorageFileStore.WriteFile(String
path, String contents)
at TrackuTransit.Core.Services.DataStore.StorageItemFileRepository.Put(String
filename, StorageItem data) InnerException:
My dev environment is setup as follows:
- Surface Pro 3
- Visual Studio 2013 Community
- Windows Phone 8.1 SDK and Simulator
- MvvmCross 3.0.0.4. (yes,, it is old and will be updated after MVP).
Before I go digging into the MvvmCross code base, anyone with ideas on what I could be doing wrong here?
Upgraded the project to .NET 4.5 and also upgraded to MvvmCross 3.5.1 and still ran into the same problem. Although I lost a couple of days due from the upgrade, I am glad it is over with.
The problem I am running into here has to do with the fact that I am calling
_fileStore.EnsureFolderExists(filename);
and passing in the full path to the file. Underneath the scenes, MvvmCross is calling
IsolatedStorageFile.CreateDirectory(filename);
which appears to be creating a directory with the same file name. So passing in "images\image1.png" to the above API appears to create a directory or hold some IO resource related to "images\images.png".
When you attempt to write to file using
_fileStore.WriteFile(filename, content);
MvvmCross is attempting to create a file stream using
var fileStream = new IsolatedStorageFileStream(path, FileMode.Create, isf))
and the exception is thrown right here.
Fix is to ensure you are passing to IMvxFileStore.EnsureFolderExists API just the folder in question. In this case it is "images". Then you pass to IMvxFileStore.WriteFile the relative path to the file including the file name such as "images\image1.png" and you are good to go.
Fixed code looks like this:
private string GetStorageItemFileName(string filename)
{
Guard.ThrowIfNull(string.IsNullOrWhiteSpace(BaseDirectory), Messages.RepositorBackingStoreIsNull);
filename = _fileStore.PathCombine(BaseDirectory, filename);
// assumption is that filename does not contain directory information
_fileStore.EnsureFolderExists(BaseDirectory);
return filename;
}
Anyone have any insight as to what this error is, and how to fix/avoid it?
Warning 1 An internal error occurred in PlatformVerificationTask. System.IO.IOException: The file exists.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.__Error.WinIOError()
at System.IO.Path.GetTempFileName()
at Microsoft.CompactFramework.Build.DeviceTypeResolver.CreateDynamicAssembly(String fileName)
at Microsoft.CompactFramework.Build.DeviceTypeResolver.LoadAssembly(String codebase, Boolean canlock)
at Microsoft.CompactFramework.Build.DeviceTypeResolver..ctor(ICollection references)
at Microsoft.CompactFramework.Build.AsmmetaContext..ctor(String ndpversion, String platformFamily, String platformID, ICollection references)
at Microsoft.CompactFramework.Build.Tasks.PlatformVerificationTask.Execute()
I have doctored up a project to run the compiler to build .NET CF dlls from within VS2010, according to this SO question ( Building Compact Framework applications with VS2010 (without VS2005) ) . The build was working but now it stopped with this odd error.
I figured it out. By... uh.... Reading the documentation.
The doc page for System.IO.Path.GetTempPathName says
The GetTempFileName method will raise an IOException if it is used to create more than 65535 files without deleting previous temporary files.
The GetTempFileName method will raise an IOException if no unique temporary file name is available. To resolve this error, delete all unneeded temporary files.
So... I deleted the tmp????.tmp files from C:\Users\USERNAME\AppData\Local\Temp, and everything worked again.