-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StartUpToDateCheck(null, 1) throws ArgumentException #471
Comments
To repro:
This will cause 'System.ArgumentException' to be thrown and F# project won't be built before 'hello' is run. Exception will be visible in Sysinternals DebugView. |
Thanks for the details. The up to date check doesn't currently pay any attention to the initial options flags, we should add proper consideration for those. AFAIK this won't affect normal user builds, but we should do our best to fully support the various automation scenarios, too. |
i can repro, the exception is raised when solutionBuildManager.FindActiveProjectCfg is called |
I've just checked to see how F# projects behave in previous versions of Visual Studio. In VS 2008, 2010 and 2013, the following returns false (or rather a H result of < 0): QueryStartUpToDateCheck(1, pfSupported, pfReady) When this happens, TestDriven.Net assumes that the project might need building and doesn't call StartUpToDateCheck (which throws the exception in VS 2015). Keeping this behavior consistent in VS 2015 might be a better fix? |
old code: QueryStartUpToDateCheck
StartUpToDateCheck
|
Did you mix up the method names there? Won't it have been QueryStartUpToDateCheck that returned On 28 May 2015 at 12:59, Enrico Sada notifications@github.com wrote:
|
@jcansdale see pr #473 . |
nope, return OK ( |
as a side note, options can contains flags from VsUpToDateCheckFlags2 ( vs 2012+ )
@latkin @KevinRansom any idea if we should manage also these flags? retro-compatibility like VSUTDCF_DTEEONLY ? |
Excellent, thanks for checking! It was indeed the supported = 0, that made On 28 May 2015 at 13:07, Enrico Sada notifications@github.com wrote:
|
@jcansdale really good bug report! easy to fix. |
I investigated a bit - root cause is that TestDriven is calling from off of the main UI thread. Various VS platform APIs will fail with E_INVALIDARG (translates to ArgumentException) if called from off of the main UI thread, and that's what's happening. I can make a small change so that our up-to-date check avoids such APIs, and we successfully handle the call from TestDriven. Will send a PR soon for this. However I notice that TestDriven is encountering many other ArgumentException errors for the same reason, unrelated to the up-to-date check. Screenshot below of one example. I wonder if this is expected? Everything appears to be working (exceptions are handled somewhere), but seems odd. |
try AFAIK there aren't any exceptions being thrown for UI thread related issues. When integrating directly with the Visual Studio COM objects (without Thanks, On 29 May 2015 at 22:46, Lincoln Atkinson notifications@github.com wrote:
|
…GetActiveConfigurationAndPlatform - Give proper consideration to the options flags passed to QueryStartUpToDateCheck - Use IVsSolutionBuildManager5.FindActiveProjectCfgName in TryGetActiveConfigurationAndPlatform, as it is not sensitive to sync context - Avoids exception for non-UI thread callers, e.g. DTEE automation Fixes dotnet#471
@jcansdale got it, I misinterpreted the cause of the other exceptions then. I've opened a PR with a fix for this, will try to get it approved for RTM. |
Call to IVSBuildableProjectCfg.StartUpToDateCheck(null, 1) throws an ArgumentException on VS 2015 RC F# projects. The 1 indicates the VSUTDCF_DTEEONLY flag is set.
On C# and other common project types, this call indicates whether Visual Studio thinks the project needs building. I've found it to be the quickest and most reliable way to find which projects need building. Unfortunately this method doesn't seem to be well documented.
Here is the full exception:
[11268] System.ArgumentException: Value does not fall within the expected range.
[11268] at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
[11268] at Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
[11268] at Microsoft.VisualStudio.FSharp.ProjectSystem.Utilities.TryGetActiveConfigurationAndPlatform(IServiceProvider serviceProvider, IVsHierarchy hierarchy, ConfigCanonicalName& configCanonicalName)
[11268] at Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectConfig.IsUpToDate(OutputWindowLogger logger, Boolean testing)
[11268] at Microsoft.VisualStudio.FSharp.ProjectSystem.BuildableProjectConfig.StartUpToDateCheck(IVsOutputWindowPane pane, UInt32 options)
I think this method may have always returned false on previous versions (rather than throwing an exception). This isn't a show stopper.
The text was updated successfully, but these errors were encountered: