MSBuild and Visual Studio crash from wrong explicit interface declaration - c#

I've painfully stumbled into a way to make MSBuild.exe hard crash Visual Studio 2019. The reporting mechanism in VS2019 doesn't seem to work (won't sign in saying something like The \"path\" argument must be of type string.), and the webpage for reporting issues says to do it through VS, so I don't know where else to post this.
It could be my installation that is the issue, and not the compiler, but I do seem to be able to hang the C# compiler online with this as well. Running a repair install did not help. I think it may be the new C# 8 compiler specifically, since the older compiler does seem to give a correct explicit interface declaration can only be declared in a class or struct compilation error instead of timing out.
It's really easy to cause, so be careful, since as soon as you type this out it hard crashes VS. You don't even need to save the file or hit build, the on-demand compiler kills VS the moment you type this out.
If you do manage to save your file then VS will die as soon as the file is on-demand compiled (so, immediately on startup if the file is already open, or as soon as you manually open the file). If you saved the file, refrain from opening it, and then hit build, you can see that the build fails due to a stack overflow exception. VS doesn't die in this case.
Normal interface (no problem so far):
public interface ITest {
int Property { get; }
}
Hard crash (MSBuild gets stack overflow and VS2019 doesn't handle it very well):
public interface ITest {
int ITest.Property { get; }
}
If anyone can (or can't) replicate this (should be easy to test) let me know and maybe you could report it to MS instead.

[updated answer]
Hi Dave,
We are working to get the sign in issue addressed. Our team has a fix in the latest preview (V16.4 preview 5). If you can give that a try to report and let us know how that goes. If you see an error, please send me the full error text. You can download the preview here: https://visualstudio.microsoft.com/vs/preview/
I have also created a report for you as a workaround. Here is the link where you can track it. Please visit the link and vote on the issue so you can get notifications on progress:
https://developercommunity.visualstudio.com/content/problem/825095/msbuild-and-visual-studio-crash-from-wrong-explici.html
Thanks
Sean
Visual Studio Feedback Systems

Related

Workflow designer asking for generated file reload every time C# expression is edited in VS 2012

I'm using VS2012 and .net 4.5. Whenever I edit C# expression in properties window I get message as shown in below image
Update:
I did not open this file. Neither in VS nor in other program. I think VS loads this file for some reason.
If I open C# expression dialog I get similar behavior to the one described here
I also often get error saying that VS cannot access this 'TemporaryGeneraterdFile_' cos it's being used by another process.
This post describes that error.
Did anyone experienced similar behavior?
It's realy anoing as it happens very often.

VS 2005 Compile on Save C#

This is baffling me, I am unable to find this setting if it exists.
I am 90% sure that my code used to compile on save before.
I only started having this issue when using C#, .net worked fine.
But now I am only able to get rid of error lines etc, when choosing to enter debug mode.
For example when I have a method
public bool Method1(){
//No code added yet so I get a blue line saying return something
}
Even when I add what to return inside the method the line remains there on save. It only goes away when I build.
(This is just one example it seems to happen with lots of other things)
EDIT - In regards to options to compile on save.
The options in Build and Run are set Correctly
That should produce a red underline and an entry in the Error List window: "not all code paths return a value". It is produced by the IntelliSense parser, not the compiler. Saving the file does not remove the error hint, only opening another project does. And fixing the code of course.
There is a bug of sorts in this logic, in some cases the Error List doesn't get purged. The only workaround I've seen is to restart Visual Studio. I've only seen this with certain IntelliSense warnings and it only affects the Error List, not the editor. I can't remember the exact type of warning that triggers this, it only ever happened when opening a project with code I didn't write. These messages don't normally last long when I'm editing code. Which is by far the best solution.
Should it not be the other way around? Save on compile.
Anyway, you can simple change the ctrl+s key combination to build and save in the settings menu.

Error 1001 An error occured in sending the command to the application

COM Excel AddIn, C#, VS2008
The error happens occasionally when I install/uninstall my AddIn.
sometimes I see Error 1001 the specified file can not be found
Anyone know what causes these and how to fix? thanks
I use windows installer
http://msdn.microsoft.com/en-us/library/2w2fhwzz%28v=VS.90%29.aspx says if use [TARGETDIR], it should be like "[TARGETDIR]\" or "[TARGETDIR] ". I simply use /filepath = "[TARGETDIR]myinstallfile" in CustomActionData
What I do not understand is it works almost all time and fails occasionally
Also even if I change this to including space or backslash, I can't tell if that fixes issue since the issue does not happen every time. Anyone has experience? thanks
I found this and it fixes the issue though I am not sure I ever use DDE in my program
http://sympmarc.com/2010/02/04/microsoft-excel-error-there-was-a-problem-sending-the-command-to-the-program/
Then I found this http://www.opendylan.org/documentation/opendylan/interop2/inte_278.htm
It talks about COM Server
so I went to cmd, type in "Excel.exe /RegServer", then the error disappears.
I am not really not sure if this solution works for all cases.
In fact, I am concerned that I miss sth in installer.
Here is a Microsoft Support page related to an issue which looks quite similar to yours. So for me it looks like a bug in Excel rather than in your installer.
The article is quite large, but it boils down to making sure that:
your Excel app is not running with elevated rights
advanced setting "Ignore other applications that use Dynamic Data Exchange (DDE)" is unchecked
Other than that you might try to repair Excel installation or follow the advice given in this thread of ASP.NET forums to fix the registry for Excel installation.
I hope it helps someone facing similar issues.
If you get this type of error when uninstalling a VS setup project MSI, then the most likely reason is that TARGETDIR is not preserved between the install and the uninstall, therefore it has no value, and attempts to use it in an uninstall custom action will result in failure to find the file. The easiest solution (apart from always installing to known locations such as common files etc) is to save TARGETDIR to the registry and retrieve it later. In the VS IDE you can create a registry item with the value [TARGETDIR] to have it resolved at install time.

Using R(D)COM for integrating R with C#

I am trying to use R(D)Com interface. I have R 2.12.1 installed on machine. For using this interface in C#, I loaded rscproxy_1.3-1 package and then installed R_Scilab_DCOM3.0-1B5 on my machine. Also, I copied sciproxy.dll from Program Files\R(D)COM Server\Scilab to Program Files\R(D)COM Server\bin, as informed while installing the interface.
My Problem:
As a part of testing, I tried the code from blog post http://vvella.blogspot.com/2010/08/integrate-c-net-and-r-taking-best-of.html. But my form application failed due to exception raised by statement rconn.Init(“R”). The exception text was Exception from HRESULT: 0x80040013 I tried to run samples from Programs->R->R(D)COM Server->Server 01 Basic Test. On launched form, I clicked button “Start R” but it failed with error printed in text box as “Initializing R...Function call failed Code: -2147221485 Text: installation problem: unable to load connector”
I tried this:
I tried to troubleshoot it with the help of Index html page, and there under installation section, I found that there must be rproxy.dll under installed R/Bin folder. Also, HKEY_LOCAL_MACHINE\Software\R-core\R\InstallPath should point to installation folder.
Things lacking on my machine are
the installed R/bin folder doesn’t
contain rproxy.dll. Where can I get
this dll? Or is it sciproxy.dll
instead?
HKEY_LOCAL_MACHINE\Software\R-core\R\InstallPath
points to installation folder, but
there is no entry under
HKEY_CURRENT_USER\Software.
I can guess there is something fishy about installation, or registering COM server. But I am not successful in figuring it out.
Could you please tell me where am I going wrong?
thanks,
Kapil
Oh god I remember this being a huge pain in the arse. Lets see if I can remember... And before I start, I warn you that I just "got this working" and never cared to work out if I could remove parts from the process.
Downloads are available from http://rcom.univie.ac.at/download.html . If I remember correctly, the RandFriends package is all you need, it installs a crapload (just install it all) but is simple. Alternatively, I think if you install the 'rscproxy' package in R you can just download the 'statconnDCOM' and install that. Memory is hazy, but I know one of these methods results in an annoying splash screen everytime you run your C# executable, and one doesn't. Although that could have just been some setting I played with.
Now, I can't remember how you verify that stuff has installed successfully. Pretty sure it comes with examples though. Once that is started, get your C# project open. Reference the following projects,
StatConnectorCommonLib
STATCONNECTORSRVLib
In your code, you will probably want to implement a IStatConnectorCharacterDevice so you get the R output coming back out in C#. Your code to initialise will then look something like,
private StatConnector _StatConn;
private IStatConnectorCharacterDevice _CharDevice;
private Whatever()
{
// declare
_StatConn = new StatConnectorClass();
_CharDevice = new MyCharDevice();
// init R, wire up char device
_StatConn.Init("R");
_StatConn.SetCharacterOutputDevice(_CharDevice);
}
Then you should be able to just use the functions as needed
_StatConn.EvaluateNoReturn("x <- 3");
var returnObj = _StatConn.Evalute("1 + 1");
Hope that helps.
tl;dr download RAndFriends, do fresh install with that
I had a similar problem calling R.Init(), I found R.GetErrorText() returns the actual error message

Monodevelop warning "Could not generate code for widgets of type: xxxx"

About 2 years ago I worked on a C# project, using MonoDevelop V1 and later V2 (beta release, compiled from source, what a mission) under Fedora. The project went dead. Now I am bringing it back to life, but I have changed my development platform to Debian (testing, i.e. squeeze), which has MonoDevelop V2.2.
I am mostly very pleased with the features of V2.2, but I have a nasty little problem. All the code compiles OK, but at the end of the compilation run I am left with lots of warnings as in the subject line. Obviously, as soon as I try and run the application, I get exceptions left, right and center when I open anything that uses these widgets.
The funny thing is that the library containing the widgets compiles just fine. But somehow these widgets (it's not all of them, only one or two) don't get exposed on the interface, and then subsequent dialogs or windows using them throw the above warning.
Has anybody had this problem? I have googled this and all that comes up is Michael Hutchinson throwing his hands in the air and saying "sorry, can't help here". I really need a fix for this, otherwise I will have to rewrite substantial chunks of code from scratch.
I would recommend trying MonoDevelop 2.4, but in any case here are some hints.
If you have an assembly which uses custom widgets implemented in the same assembly, you may be having a chicken-egg problem, since MonoDevelop needs the built assembly in order to find the custom widgets, but that's the assembly you are trying to build. This problem can be easily solved by building again the project after you get the warnings you reported. Beware, you have to build, not rebuild, since rebuild will delete the assembly and you'll hit the same problem again.
If you are not having the above problem, or if the solution doesn't work, the problem may be that the objects.xml file that contains the information about the exported widgets is not properly updated. You'll find that file in the project that implements the custom widgets, in a hidden gtk-gui folder. Open the file and check if the all the custom widgets are declared there. If a widget is missing, try opening the source code file of the widget and do a small change (e.g. a whitespace change) and then build the project again. MonoDevelop should be properly updating the file.
If you are still having trouble, please file a bug report.
I think I found a way out. Not sure whether this is the "official" method, but it seems to work.
In this library a normal widget's class definition starts like this:
namespace Amino.Common
{
//! A text entry combined with a pop-up date selector, very useful for otherwise busy dialogs
public class DatePicker : Gtk.Bin
{
If I now add two additional declarations right in front of the class statement, like this:
namespace Amino.Common
{
//! A text entry combined with a pop-up date selector, very useful for otherwise busy dialogs
[System.ComponentModel.Category("Common")]
[System.ComponentModel.ToolboxItem(true)]
public class DatePicker : Gtk.Bin
{
then
That widget gets included in the objects.xml file and
The entire solution compiles as expected (and runs as expected).
Maybe somebody could shed some additional light on this, I would love to understand this better.

Categories

Resources