VS2008 on Win 7 cannot write resources file. Parameter is not valid - c#

We load a C# project out of TFS, click on the solution and it builds fine on XP, but dies on Windows 7, with multiple
Cannot write "C:...\projectName.resources." Parameter is not valid.
and one error that mentioned GDI+. Web searches turn up hits about constructing GIF objects in a program, but little about this problem except suggestions to replace all images with PNG's, with some posts implicating alpha channel problems in the Bitmap class. I tried that approach for TIF's and it made the GDI error go away, but some of the images are animated GIF's that our users are trained on and we don't want to change those. Another suggestion was to replace the Bitmap class with a third party version, which seems kind of drastic and it is not free, so we didn't try it yet.
On 7 the build also fails from the command line, and it fails for GIF's from the XP project or ones new'ed on Win 7 from the designer now.
Is it really the case the VisualStudio 2008 running on Win 7 only
supports PNG's?
But then why would designer let users add a GIF, and then give this error at build time?
The few posts I find are from 2011 and blame the Bitmap class. Looks like a single class could have been straightened out by now, if that is in fact the problem.

Related

Visual Studio 2013 designer for Windows Phone not working

I have Windows 8.1 on a Virtual Machine (Oracle VirtualBox). I use this machine to develop apps on my windows phone (directly on the phone, not via emulators).
Everything worked fine for a long while and suddenly, out of nowhere, the designer stopped working...
The problem looks like this:
I can add controls, however I cannot see them in the designer, only shows some black square at top-left of the phone designer. (It works fine later on the phone, but I cannot view it in Visual Studio). There are no errors anywhere. It is really annoying and I cannot seem to find any answer so far...
Any ideas?
Thanks,
Keran.
Posted by Varun Mashru on 5/23/2014 at 3:54 AM on Visual Studio Feedback Forum
Surprisingly and fortunately, I found the solution just two days ago.
It is a bit of a bummer but that's what it is.
It has nothing to do with the VS setup or the OS.
The first thing to notice here is that it happens with notebooks only.
The REASON??
Because notebooks do not have completely dedicated GPUs. These GPUs
act as secondary processors for the onboard graphics solution which is
directly connected to the display. Hence they fire up only when
needed.
My notebook is a Dell Inspiron 15 3537 -- Core i5 4200U (Intel HD Graphics
4400 onboard) + AMD Radeon HD 8670M. It has a switchable graphics
solution. Hence the software chooses as to which GPU does the
weight-lifting.
The power settings, when cranked up to the max, indicate that the AMD
GPU must be the one that should take the lead.
And in the case of VS it does not happen properly (Don't know why??).
Maybe the UI components can't decide which GPU processor to choose
or whatever.
So the simple workaround I found was to bring the graphics settings
down by just a notch. Which is selecting the 'Optimize Performance'
option in the Switchable Graphics instead of the 'Maximize Performance'
field in the power plans.
And voila, It works perfectly fine!!!!
Share this with everyone who has freaked out for months on this
issue!! :)
Though the answer from Hassan El-Zarkawy is also useful, the real problem for me was with Oracle Virtual Box...
At some point I have turned on 3D acceleration for the VM. This messed up the designer in the Visual Studio. As soon as I turned it off, everything worked fine, even on the high performance battery setting.
I don't know if it matters, but I also switched to 1 core for the virtual machine, it seems to work better now apparently...
Anyway, thanks for the help.

WPF visual problems on Windows XP

We have a huge project in WPF .NET 4.0 which should support Windows XP SP3 and above. (hence the use of .NET 4.0) It has no problems whatsoever on Windows 7 and 8/8.1. However we're experiencing major visual issues when running on Windows XP to the point that the application is unusable.
I searched a lot and came across some similar questions such as this one but none of the suggested solutions worked for us.
Here's an screen shot taken on Windows XP SP3:
The odd thing here is that there is clone of "28" TextBlock you see in the screen shot, to the left of it. They have everything in common except their name but the left one is not rendered properly!
And here is how it really looks like (taken on a Windows 8.1 test machine):
Some pages are even worse:
When I remove AllowsTransparency from the main window, it looks like this on XP: (Note that the title bar has no problems any more)
We're really stuck and have no clues about its cause. Any help would be appreciated.
It seems this problem is related to the graphic card. In another VM with a different graphics accelerator we didn't face any major problems. In the problematic test machine, we lowered hardware acceleration to the third level and the problem is gone.
Display Properties -> Settings -> Advanced -> Troubleshoot
Although there are still some small issues with some mouse over animations and we lost the benefits cursor accelerations bring to the table, it's acceptable for us since not much is expected from Windows XP.

Use of WMPLib on Windows N editions

I have a problem and I don't know how to work around it: I used the WMPLib in my C# application (located in C:\Windows\System32\WMP.dll). I referenced it and dded it in the header of the main form's code file:
using WMPLib;
But if I try to run my app on a Windows N edition (I think also the KN edition counts here), it stops working and Windows shows the following message: "App-name has stopped working. You can check for a solution...". So now, I'm trying to find a way to work around this, for example, by not importing that DLL at run time when user is running a Windows N edition.
I'm afraid that I wouldn't have a way to redistribute my app to Windows N users.
Thanks for any advice,
Vali
The N editions do not come with Windows Media Player installed by default, which explains why the DLL is missing. Windows Media Player can, however, be installed after the fact.
This leaves you with two choices:
Dyamically load the DLL at runtime
Check for, and require that Windows Media Player is installed as a prerequisite (i.e., during setup)
You may actually want to do both. If your application requires this assembly to get its job done, on app startup, you probably want to check if the DLL is available. If it isn't, displaying a meaningful error message would be preferable to an outright crash.

AxShockwaveFlash appearing as a white box on Windows XP Embedded from a C# winform

I have created an app in C# .Net 2.0 that uses the AxShockwaveFlash object to display youtube videos given from the youtube API. The object itself works fine on the PC I am doing the development (normal Windows XP) but as soon as I put it on our release machines (XP Embedded) the shockwave object just appears as a white screen.
I have added the following:
Registry settings:
[HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\FlashPlayerPlugin]
"Path"="C:\\WINDOWS\\system32\\Macromed\\Flash"
"Version"="11.1.102.55"
"PlayerPath"="C:\\WINDOWS\\system32\\Macromed\\Flash\\NPSWF32.dll"
[HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\FlashPlayerPlugin\Components]
"Main"="1"
Adding the flashplayer.xpt file to the location specified and the NPSWF32.dll to the same place as well. This hasn't changed anything but I am stuck and have no real idea what to do. Anything I have missed?
For anyone interested we were missing a few files that the object required in order to run, unfortunately I don't have a list of them to hand at the minute, will have a look for the specific names if requested.

"The image format is unrecognized" depending on monitor

We have a C# WPF project (.NET 4.0, Visual Studio 2010). It has been tested on both Windows XP and Windows 7 and seems to work fine, but now I have received reports from two customers on the field (both located in Spain for some reason) who cannot start the software.
Looking at the log file I see that they get "The image format is unrecognized" exception (Caused by: Exception from HRESULT: 0x88982F07).
I have googled on the error and I have found that this seems to be that WPF fails to load the Vista PNG icon on Windows XP. But those reports are a couple of years old, surely Microsoft resolved it by now (?), and in my case it works fine on most XP installations. I really don't want to limit the icon appearance on more recent Windows.
The most common use of our application is on Laptops, and one of the users reported that when he connected his laptop to an external monitor the problem got resolved. And when I asked the other one to test the same thing he had the same result.
So my questions are: Do you know if this problem has been resolved by Microsoft? Do you know why it only happens on some Windows XP instances and how it is related to the monitor? And most importantly, do you know what I could do to make our application more robust to this without changing the icon?
I had the same error today, out of the blue, and only on my development machine. The WPF implementation seems to be still buggy.
If I understand this (article) right, it can occur everywhere ICO files are read. In my case it was while setting an icon for the main application window in XAML:
<Window x:Class="MyApp.MainWindow" Icon="Dashboard.ico" >
The above code failed suddenly, but using a PNG file solved the problem:
<Window x:Class="MyApp.MainWindow" Icon="Dashboard.png" >
I've had a bit of fun with this problem this morning. It turned out that the error was occurring only on XP machines where the colour settings were set to 16 bit, and when I changed it to 32-bit the problem magically disappeared.
This goes for XP (including Embedded) SP3.
this issue has had me pulling my hair off for quite a long time, and I have spent quite a while trying to figure out what was going on so I'll share my conclusions since it might help someone else (possibly even myself in the future) :
this issue appears mainly on windows XP and/or when connecting via remote desktop (especially on windows server). But it is kind of random and impossible to replicate on purpose
those links provide a good explanation as well as a solution/workaround :
http://code.logos.com/blog/2008/08/image_format_error_when_loading_from_a_stream.html
https://github.com/LogosBible/Logos.Utility/blob/master/src/Logos.Utility/IO/RebasedStream.cs
using a png file directly will work, but it has its limitations (for instance, I use .ico files so as to have multiple images depending on the size of the displayed icon and a .png file cannot replace a .ico file for this purpose)
the best answer - and what I ended up doing - is what Joachim said in his comment of the OP's question :
https://social.msdn.microsoft.com/Forums/vstudio/en-US/9e723d51-0e26-4609-8fe1-5e0edcf7385b/setting-windowicon-to-vista-256x256-png-icon-causes-a-fileformatexception?forum=wpf
seems to indicate it'll resolve itself if you don't compress the icon.
– Joachim Isaksson Jan 23 '12 at 12:44
so I looked up in icoFx (that I use for my icon editing) and sure enough :
I simply unchecked this and saved my .ico again (size went from 30Kb up to 286Kb in the process!) and voilà!
problem solved

Categories