I've written an application in C# .NET with the WinForms UI toolkit. I'm attempting to provide Windows executables, but so far they simply don't work for anyone but me.
I'm creating the release packages by building the EXE and DLLs in Visual Studio 2017, copying them into one place, and putting that into a .zip archive. I'm not doing the fancy one-click publishing stuff.
The project is available on github (https://github.com/fadden/6502bench). The first person to try it got "<program> has stopped working" on Win7 (see issue). The second person was using Win10 Pro, and extracted some details from the event log that show it crashing in a system DLL (see issue). Both of them have the latest .NET framework installed.
I haven't worked with C# .NET outside Unity, so I'm a bit out of my depth. It's entirely possible I've skipped an "obvious" step, or am doing things wrong.
Update: answering some of the comments:
it's pure C#, no native or unsafe code
both people reporting problems confirmed that that latest .NET framework is installed (4.7.2)
the program doesn't seem to be starting at all, so I'm not sure what the app could be doing wrong as far as local paths go
the specific errors, including screen shots and log messages, are included in the issues linked above
the full source code, with the VS solution and projects, is up on github
The sense I'm getting from the comments is that what I'm doing isn't fundamentally wrong, so there's some devil in the details.
I downloaded the source, and debugged.
I received a StackOverFlowException on the following 2 lines of code.
ProjectView.cs
line 3545 : symbolListView.Columns[2].Width = lastWidth;
line 3719 : referencesListView.Columns[2].Width = lastWidth;
What is going on is you are handling the ColumnWidthChanged event on ListView components, and modifying the column width. This modification fires the event again, which is causing an infinite loop, and a subsequent StackOverflowException.
But why? I'll take a swing at an answer. You may have hard coded some values that line up with the DPI and resolution of your monitor. When the ListView instantiates on your machine, it doesn't have to 'redraw' the column with and does not fire the event, but for anyone else that doesn't have the same resolution and DPI, the event fires and causes the loop. I could be wrong, but sounds plausible to me.
Related
Okay so I wanted to get into mobile development and decided to start with Android Studio, but I wanted to more easily reach both Android and IOS so switched over to Xamarin.
Honestly, Xamarin looks really cool and I have been trying so hard to get into it, but every time I open a new Xamarin project it seems to break right away before I really get to do anything.
Sometimes it asks me to update something so I do so before I begin development and it breaks, sometimes I run an initial build right when I make the project with no changes made and it breaks. Sometimes I do something as simple as adding a button or entry in the XAML code and it just breaks, and when I erase all my changes it is still broken.
I just want to know, is this just me or is this just how Xamarin is? I know there is a huge chance it is just me having no idea what I'm doing, but the project seems to break even when I follow updated tutorials and documentation. I have gotten errors even involving the file path it made.
Summary
The short time I used Android Studio I was able to get decently far into development and it still didn't break, but with Xamarin I am having a hard time just getting past the creation of the project without some error. Why is this? Does this happen to experienced Xamarin Developers or just for beginners?
There are certainly issues in Xamarin Mobile Development. Those issues you are referering, happen to everyone from time to time (not that common these days though).
Ignore compiling errors (assuming its the programmer's fault), those issues are usually related with Visual Studio. So, the process is always the same:
Clean Solution
Delete bin/objs folders (if the clean has errors)
Restart Visual Studio
Rebuild
I've read plenty of answers on here about how to deal with the error 0x80029C4A (TYPE_E_CANTLOADLIBRARY) that say that regsvr is the way to go and checking the registry to make sure that the dll I'm using is properly registered.
I've done all of this on computers other than my dev box but still nothing so here's what I have:
The DLL I'm trying to refer to was developed in VB6 (SP6) with the following settings:
Single Threaded
Upgrade ActiveX Controls
Binary Compatibility
I'm trying to reference it from C# using .NET 4.0 and it all works swimmingly on the machine that I'm developing on, however, when I try to use the project on any other computer that has the dll installed in exact same way I get the error above.
UPDATE:
This dll works fine, as I would want it to, when used from a VB6 application on all of the computers involved.
Can anyone please shed some light onto what is happening here and how I might solve it? I have the VB6 dll and can distribute it with my current project if that would help at all.
Many Thanks,
Gareth
I worked this one out I think... Foolish me was trying to use the DLL in a background thread and even though it was an STA thread it wasn't my friend.
This issue is getting real tiresome and I've been spending atleast 2 days looking around for an answer. Basically, I want to publish a game, and I've hired a friend of mine to test it out before I officially release it. Whenever he runs it, reports as "nothing happends".
These conditions are met:
He has installed the .NET Framework 4.0 and the XNA Redistributable 4.0 (he most likely also has installed other .NET Frameworks and XNA Frameworks as well, because nothing worked).
The game is compiled onto a Release build.
GamerService referenced is removed.
A possible issue could be that he's using Win8, but as my searching experience goes, XNA DEVELOPMENT is only restricted on Windows 8, right?
So, what's going on? I'm clueless.. I even put a MessageBox.Show(); after the execution of my game in my Program.cs file via try/catch, and no results.
Are there any extreme conditions in my code that I need to meet?
Any site describing 100% of all requirements to run an XNA game and the most proper way to build it?
Any issues when using non-distributable "developer tools" in XNA coding? If so, what includes in these "developer tools", and what do I need to modify? (I noticed that on another thread).
An answer to this issue would more than make my day...
Ah, and also, I tried running it on a virtual machine ( Windows 7 ) but then it spat out a messagebox saying Index outside the bounds of the array on a perfectly valid code execution, and various other random errors such as missing files when they clearly are there.
Thank you greatly!
In summary I think your app wont run on Windows 8, let me explain:
Windows 8
A possible issue could be that he's using Win8, but as my searching experience goes, XNA DEVELOPMENT is only restricted on Windows 8, right?
Officially, desktop games using unmodified Microsoft XNA 4/is not supported on Windows 8 in any form:
Microsoft officials have said the XNA tools/runtime environment used primarily by game developers isn't supported on Windows 8. - Read more...
Redistributables
Any issues when using non-distributable "developer tools" in XNA coding?
That depends on whether they are required at runtime on the target machine. That might sound like an oxymoron but in Windows c/c++, I can have an app that depends on Microsoft DLLs but we are not allowed to deploy the DLLs, one must depend on it being present in the OS; service pack or some other form. Is there something you are missing?
Windows 7
Ah, and also, I tried running it on a virtual machine ( Windows 7 ) but then it spat out a messagebox saying Index outside the bounds of the array on a perfectly valid code execution
This is more interesting and I suspect is one of the more testable aspects of your application (also that it is not Windows 8). I suggest you setup a remote-debug session to your Win7 VM or if that is not possible, use Debug.WriteLine() or equivalent displaying critical state contents.
We have a very complex software primarily written using .NET WinForms in C#. Many people have contributed to it. One such contribution was the addition of a Windows Presentation Foundation (WPF) control hosted in Win Forms. The said control is considered a common control and used in many places in the application.
Everything was working fine till a few days ago when we started seeing inordinate delay in launching the application. The application used to launch in less than 5 minutes, but now takes 20 minutes to launch.
We have been analyzing the situation but have found it very hard to pin down the real issue. We have seen that our misbehaving common control that is used at multiple places, eventually calls the following framework functions:
The time taken by the system functions to perform their duties is shown in the picture above. The system functions take around 1.5 minutes each time the common control is initialized. We use the common control at least 8 times in our application. So, a total of 12 minutes.
Has anyone else seen such issues with WPF controls hosted on WinForms?
Any help would be appreciated.
EDIT:
There is an issue with C# Dictionary we use. Getting rid of it by using a List<> solves the delay issue. Microsoft has reproduced the issue at their end. They are working on it.
Maybe, our application took C# Dictionary to the edge ;)
Thank you all for providing your inputs.
This is likely to be the Initialization of the WPF control rather than something to do with the ElementHost or the fact that it's hosted within WinForms.
Without seeing the code for the WPF UserControl its hard to tell you what that might be but I would say that the interop of WPF / WinForms is certainly a red herring.
You can try using the Ngen:
The Native Image Generator (Ngen.exe)is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead of using the just-in-time (JIT) compiler to compile the original assembly.
If the assemblies of project will be compiled with help of Ngen, there is no need to run every time JIT-compiler before starting application and loading metadata of using assemblies.
Ngen will find all of the static dependence of the main assembly and compile them all in a low-level images. These images will be stored in cache of assemblies (GAC), thereby it is possible to reduce application load time.
I was really excited when I found GeckoFX last month. My employer wants to distribute an embedded browser with our desktop application (to smooth the transition from desktop-based apps to web-based apps), and being able to use Gecko rather than IE was a miracle!
The latest versions of GeckoFX I can find use versions 1.9.1 and 1.9.2 of the Gecko engine (Xulrunner). This works just fine, but it's missing a lot of the goodies that shipped with Firefox 4 (Gecko 2.0) this week.
I already have the distribution of Xulrunner 2.0, but GeckoFX won't work with it out of the box. Some of the XPCOM API has changed, and I'm sure there are a lot of other minor incompatibilities. I'd say it should be an easy fix, but I'm not a C++ developer so I really have no idea.
What I'm looking for right now is one of the following, in order of preference:
An already-built update of GeckoFX that's compatible with Xulrunner 2.0
Another solution that allows me to embed a Gecko-powered web browser in a C# Windows application.
Advice on where to start to update GeckoFX myself (by advice I mean hold-my-hand-and-talk-to-me-like-I'm-6 advice)
Just digging in to the code and trying to sort through all the errors doesn't help. I keep getting an InvalidCastException when trying to create an instance of nsIWebBrowser (and no, I can't get more descriptive than that because that's all the error message and stack trace show!). It's been a lot of head scratching and pointless Googling since it seems no one's kicked off an embedded Firefox 4 yet.
Ideas? Suggestions?
In the absence of deeper help, I took the time to dig in and figure things out on my own. The trick was understanding ComImport, which is something I haven't used before.
It turns out, Mozilla changed the GUIDs of some of the API methods exposed by XPCOM. Most importantly, the GUID for nsIWebBrowser changed from 69E5DF00-7B8B-11d3-AF61-00A024FFC08C to 33e9d001-caab-4ba9-8961-54902f197202.
Making this one change in nsInterfaces.cs actually fixed quite a bit.
Going through line-by-line and reconciling build errors (despite cryptic error messages) allowed me to finish out the system and create a build that does indeed run XULRunner 2.0.
Unfortunately, being able to build and run Gecko 2 and exposing the entire API are two very different things. I've created a project on Google Code to house a complete rewrite of GeckoFX for Gecko 2: Leapin' Lizard. It's essentially a fork of the original Skybound.Gecko code, and distributed under the same open source licenses.
So I now have a build of GeckoFX that's compatible with XULRunner 2.0. It just needs to be polished.
At the moment there is no pre-compiled library that wraps XulRunner 4.0. I am the author of MozNET, a Mozilla wrapper build that is actually being actively developed. I do have a semi-working build, utilizing XulRunner 2.0 but, it is not yet complete. Due to the changes made in XulRunner 2.0 there are still a ton of changes to in order to make MozNET fully compatible with the new build. At the moment I have full browsing support, nearly-complete DOM object access and full spell check support. The build is a work in progress as I am still maintaining and supporting MozNET 1.9.2.17.