.net-4.5

“Value does not fall within the expected range” when opening RandomAccessStream

我的梦境 提交于 2019-12-13 17:04:57
问题 I have been struggling with this problem for days. Why do I get " Value does not fall within the expected range " exception in this conversion method? (it's windows phone 8.1 app) public static async Task<string> ConvertToBase64(this BitmapImage bitmapImage) { RandomAccessStreamReference rasr = RandomAccessStreamReference.CreateFromUri(bitmapImage.UriSource); var streamWithContent = await rasr.OpenReadAsync(); //raises an exception byte[] buffer = new byte[streamWithContent.Size]; var result

SimpleOrientationSensor returning Null

跟風遠走 提交于 2019-12-13 15:12:13
问题 I'm using SimpleOrientationSensor to get the screen orientation information in my application. I'm testing this application in Windows Simulator but I always get the sensor object's value as null. This is what I'm doing: SimpleOrientationSensor sensor; sensor = SimpleOrientationSensor.GetDefault(); if (sensor != null) { sensor.OrientationChanged += sensor_OrientationChanged; } I understand that SimpleOrientationSensor.GetDefault() will return null when there is no Sensor available. Should I

Can't see past the NULL Terminator

痞子三分冷 提交于 2019-12-13 13:34:04
问题 I've been struggling with this for a while. I created a utility that allows you to open .TXT files. These text files contain PCL (Print Command Language). When I import a new file, it is being truncated by a \0 (NULL Terminator character). Because PCL files contain graphic images randomly throughout everything I import is truncated at the first bitmap image because the bitmap images start with NULL. This is the exact issue as seen here: Displaying Raw Data From Image File Using TextBox or

Replacement for standalone FedUtil to update system.IdentityModel

两盒软妹~` 提交于 2019-12-13 13:29:56
问题 i'm looking for a replacement of the Microsoft Federation Utility (FedUtil) from the WIF SDK, which allows me to automatically update (especially) the trustedIssuers list inside a web.config. The old FedUtil could to this with /m /u as parameters. Now the tool is included in VisualStudio and MS claims, there's no standalone replacement for FedUtil (refer to: http://msdn.microsoft.com/en-us/library/jj157089.aspx). My question is: Do i have to do the updates manually now or is there some

Unresolved reference to symbol 'Property:NETFRAMEWORK45' in section 'Product:*'

梦想的初衷 提交于 2019-12-13 12:25:30
问题 I am getting an error when building an app in TFS 2010. Unresolved reference to symbol 'Property:NETFRAMEWORK45' in section 'Product:*'. This is for Wix 3.9 The Wix package has NetFxExtension referenced. I can build the wix on my local machine fine, but when I go to build it through TFS I get the error. Can anyone help me figure this out? I have the below code that is causing the error. <PropertyRef Id="NETFRAMEWORK45"/> <Condition Message="This application requires .NET Framework 4.5. Please

Directory.GetFiles - different output dependent on OS

拥有回忆 提交于 2019-12-13 12:00:07
问题 I have a simple program. It runs .NET 4.5 and is built in Visual Studio 2013. D:\\MyDir is full of .xlsx files and no .xls files. When I run the program on Windows 8.1 x64, the filter for *.xls returns no results. When I run the same program, with the same .NET version on Windows 7 x86, the *.xls filter returns the same results as the *.xlsx filter. The test folders on both systems definitely contain the same data. Am I missing something, or is this a bug in .NET and/or Windows? The

Asynchronous tasks, waiting in main thread for completition

最后都变了- 提交于 2019-12-13 10:19:57
问题 I have set up quite detailed example for this task, it may be poorly written in terms of architecture and some .NET usage, but I'm just starting. Example: http://pastebin.com/uhBGWC5e The code that is of problem here, is the Main method: public static void Main (string[] args) { Log("Initializing..."); // Define listeners. TcpListener s1 = CreateAndStartServer(IPAddress.Any, 1337); TcpListener s2 = CreateAndStartServer(IPAddress.Any, 1338); // Start async. Task.Factory.StartNew(Accept, s1);

C#.net identify zip file

人盡茶涼 提交于 2019-12-13 07:34:45
问题 I am currently using the SharpZip api to handle my zip file entries. It works splendid for zipping and unzipping. Though, I am having trouble identifying if a file is a zip or not. I need to know if there is a way to detect if a file stream can be decompressed. Originally I used FileStream lFileStreamIn = File.OpenRead(mSourceFile); lZipFile = new ZipFile(lFileStreamIn); ZipInputStream lZipStreamTester = new ZipInputStream(lFileStreamIn, mBufferSize);// not working lZipStreamTester.Read

Why can't my .NET 4.5 project use a DLL compiled for .NET 4? (Both use EF 5)

≯℡__Kan透↙ 提交于 2019-12-13 05:19:33
问题 I have an application that consists of a client-side application and a WebApi website. My client-side stuff is targetting .NET 4 so that I don't have to insist that users install .NET 4.5. My website, however, is entirely under my control, so I'm targetting .NET 4.5. There is one shared assembly, which I use for data access. It uses Entity Framework 5. When I build the client application, the DLL used is version 4.4.xxx, whereas when I build the web application, the DLL is 5.0.xxx. Up until

How to read a MSBuild property in a given project in runtime?

不羁岁月 提交于 2019-12-13 04:38:55
问题 I want to access a MSBuild variable inside an unit test, which is a .NET 4.5 class library project (classic csproj), but I failed to find any articles discussing a way to pass values from MSBuild into the execution context. I thought about setting an environment variable during compilation and then reading that environment variable during execution, but that seems to require a custom task to set the environment variable value and I was a bit worried about the scope of the variable (ideally, I