Skip to content
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

Aborting test run when source and target frameworks/architectures are incompatible #1789

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f60b214
ExceptionWhenTargetingDiffFramworksPlat
vagisha-nidhi Oct 9, 2018
0a8e968
Acceptance tests updated
vagisha-nidhi Oct 23, 2018
ce5de2f
Merge branch 'master' of https://github.com/Microsoft/vstest into Tar…
vagisha-nidhi Oct 29, 2018
37fa219
Message change in conflict dlls
vagisha-nidhi Oct 29, 2018
75e2164
Changes in methods
vagisha-nidhi Dec 1, 2018
92fe52c
Merge branch 'master' of https://github.com/Microsoft/vstest into Tar…
vagisha-nidhi Dec 1, 2018
9943636
minor fix in test
vagisha-nidhi Dec 1, 2018
30ebd14
fix in test
vagisha-nidhi Dec 6, 2018
e6230ba
improved error message
vagisha-nidhi Dec 21, 2018
3fa02c1
PR comments
vagisha-nidhi Dec 31, 2018
ce59bb3
fix acceptance test
vagisha-nidhi Jan 2, 2019
d7057e2
Merge branch 'master' of https://github.com/Microsoft/vstest into Tar…
vagisha-nidhi Jan 2, 2019
220c955
Refactoring InferRunSettingsHelper
vagisha-nidhi Jan 14, 2019
c9740ea
Refactor
vagisha-nidhi Jan 14, 2019
e4f233f
Merge branch 'master' into TargetingDifferentFrameworks
vagisha-nidhi Jan 14, 2019
2e66caa
Tests updated
vagisha-nidhi Jan 14, 2019
550b4cc
Merge branch 'TargetingDifferentFrameworks' of https://github.com/vag…
vagisha-nidhi Jan 14, 2019
10bc3f3
Update TestRequestManager.cs
vagisha-nidhi Jan 16, 2019
ed39fbd
Restructured and Added test
vagisha-nidhi Jan 16, 2019
58b3dfa
Merge branch 'TargetingDifferentFrameworks' of https://github.com/vag…
vagisha-nidhi Jan 16, 2019
bc8c120
Update TestRequestManager.cs
vagisha-nidhi Jan 16, 2019
e850846
minor change
vagisha-nidhi Jan 21, 2019
b033b87
Merge branch 'TargetingDifferentFrameworks' of https://github.com/vag…
vagisha-nidhi Jan 21, 2019
3d5b844
minor change
vagisha-nidhi Jan 23, 2019
615fbac
Merge branch 'master' into TargetingDifferentFrameworks
vagisha-nidhi Jan 31, 2019
35ba9e5
Merge branch 'master' of https://github.com/Microsoft/vstest into Tar…
vagisha-nidhi Feb 12, 2019
1ddc150
Merge branch 'master' into TargetingDifferentFrameworks
vagisha-nidhi Feb 12, 2019
6bcc76c
Modified logic in IsFrameworkIncompatible
vagisha-nidhi Feb 12, 2019
7836605
Merge branch 'TargetingDifferentFrameworks' of https://github.com/vag…
vagisha-nidhi Feb 12, 2019
53b609b
Removing unused variable
vagisha-nidhi Feb 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,18 +612,21 @@ public static bool TryGetFrameworkXml(XPathNavigator runSettingsNavigator, out s
/// Returns the sources matching the specified platform and framework settings.
/// For incompatible sources, warning is added to incompatibleSettingWarning.
/// </summary>
public static IEnumerable<String> FilterCompatibleSources(Architecture chosenPlatform, Framework chosenFramework, IDictionary<String, Architecture> sourcePlatforms, IDictionary<String, Framework> sourceFrameworks, out String incompatibleSettingWarning)
public static IEnumerable<String> FilterCompatibleSources(Architecture chosenPlatform, Framework chosenFramework, IDictionary<String, Architecture> sourcePlatforms, IDictionary<String, Framework> sourceFrameworks, out String incompatibleSettingWarning, out bool incompatibilityErrorFound)
{
Copy link
Contributor

@singhsarab singhsarab Nov 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid multiple outs ?
It just makes it unreadable and confusing.

Ideally, we should change this method to TryFilterCompatibleSources or Throw an exception and catch it in the caller. #Resolved

Copy link
Contributor Author

@vagisha-nidhi vagisha-nidhi Nov 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One way is to leave this method as it is and using public static bool TryGetSettingIncompatibility(Architecture chosenPlatform, Framework chosenFramework, IDictionary<String, Architecture> sourcePlatforms, IDictionary<String, Framework> sourceFrameworks) to return if there is any incompatility found. #Resolved

Copy link
Contributor Author

@vagisha-nidhi vagisha-nidhi Dec 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split it into two functions as suggested TryGetSettingIncompatibility(Architecture chosenPlatform, Framework chosenFramework, IDictionary<String, Architecture> sourcePlatforms, IDictionary<String, Framework> sourceFrameworks) #Resolved

incompatibleSettingWarning = string.Empty;
bool incompatibilityFound = false;
incompatibilityErrorFound = false;
List<String> compatibleSources = new List<String>();
StringBuilder warnings = new StringBuilder();
warnings.AppendLine();
bool incompatiblityFound = false;

foreach (var source in sourcePlatforms.Keys)
{
Architecture actualPlatform = sourcePlatforms[source];
Framework actualFramework = sourceFrameworks[source];
bool isSettingIncompatible = IsSettingIncompatible(actualPlatform, chosenPlatform, actualFramework, chosenFramework);
incompatibilityErrorFound = IsFrameworkRuntimeIncompatible(actualFramework, chosenFramework) || IsPlatformArchitectureIncompatible(actualPlatform, chosenPlatform);
if (isSettingIncompatible)
{
string incompatiblityMessage;
Expand All @@ -632,15 +635,14 @@ public static IEnumerable<String> FilterCompatibleSources(Architecture chosenPla
incompatiblityMessage = string.Format(CultureInfo.CurrentCulture, OMResources.SourceIncompatible, onlyFileName, actualFramework.Version, actualPlatform);

warnings.AppendLine(incompatiblityMessage);
incompatiblityFound = true;
incompatibilityFound = true;
}
else
{
compatibleSources.Add(source);
}
}

if (incompatiblityFound)
if (incompatibilityFound || incompatibilityErrorFound)
{
incompatibleSettingWarning = string.Format(CultureInfo.CurrentCulture, OMResources.DisplayChosenSettings, chosenFramework, chosenPlatform, warnings.ToString(), multiTargettingForwardLink);
}
Expand Down Expand Up @@ -685,5 +687,35 @@ private static bool IsFrameworkIncompatible(Framework sourceFramework, Framework
}
return !sourceFramework.Name.Equals(targetFramework.Name, StringComparison.OrdinalIgnoreCase);
}

/// <summary>
/// Returns true if source platform is incompatible with target platform.
/// </summary>
private static bool IsPlatformArchitectureIncompatible(Architecture sourcePlatform, Architecture targetPlatform)
{
if (sourcePlatform == Architecture.X86 && targetPlatform == Architecture.X64 ||
Copy link
Contributor

@singhsarab singhsarab Nov 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check not equals for source and target platform? #Resolved

Copy link
Contributor Author

@vagisha-nidhi vagisha-nidhi Nov 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are different platforms(X86, X64, ARM, AnyCPU)
If we simply check for not equals, any of the incompatibility will be marked as true.
This might cause unnecessary incompatibility. For example source = Architecture.X64 is okay to run with target = Architecture.AnyCPU.
Do we want to change that behavior? #Resolved

sourcePlatform == Architecture.X64 && targetPlatform == Architecture.X86)
{
return true;
}

return false;
}

/// <summary>
/// Returns true if source Framework Runtime is incompatible with target Framework.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Framework and runtime are two different concepts.
Let's just call it Framework.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

/// </summary>
private static bool IsFrameworkRuntimeIncompatible(Framework sourceFramework, Framework targetFramework)
{
string sourceFrameworkName = sourceFramework.Name.Split(',')[0];
string targetFrameworkName = targetFramework.Name.Split(',')[0];

if(sourceFrameworkName.Equals(".NETFramework",StringComparison.OrdinalIgnoreCase) && targetFrameworkName.Equals(".NETCoreApp", StringComparison.OrdinalIgnoreCase) ||
Copy link
Contributor

@singhsarab singhsarab Nov 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when we have NetStandard ? #Resolved

Copy link
Contributor Author

@vagisha-nidhi vagisha-nidhi Nov 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NetStandard will have no incompatibility with any of the other frameworks(NETFrameworks and NETCore).
Should it fail with NETStandard as well? #Resolved

sourceFrameworkName.Equals(".NETCoreApp", StringComparison.OrdinalIgnoreCase) && targetFrameworkName.Equals(".NETFramework", StringComparison.OrdinalIgnoreCase))
{
return true;
}
return false;
}
}
}
22 changes: 15 additions & 7 deletions src/vstest.console/CommandLine/InferHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ internal InferHelper(IAssemblyMetadataProvider assemblyMetadataProvider)
/// <summary>
/// Determines Architecture from sources.
/// </summary>
public Architecture AutoDetectArchitecture(List<string> sources, IDictionary<string, Architecture> sourcePlatforms)
public Architecture AutoDetectArchitecture(List<string> sources, IDictionary<string, Architecture> sourcePlatforms, out bool isArchitectureIncompatible)
{
Architecture architecture = Constants.DefaultPlatform;
isArchitectureIncompatible = false;
try
{
if (sources != null && sources.Count > 0)
Expand Down Expand Up @@ -66,6 +67,7 @@ public Architecture AutoDetectArchitecture(List<string> sources, IDictionary<str
{
finalArch = Constants.DefaultPlatform;
EqtTrace.Info("Conflict in platform architecture, using default platform:{0}", finalArch);
isArchitectureIncompatible = true;
}
}

Expand All @@ -91,21 +93,27 @@ public Architecture AutoDetectArchitecture(List<string> sources, IDictionary<str
/// <summary>
/// Determines Framework from sources.
/// </summary>
public Framework AutoDetectFramework(List<string> sources, IDictionary<string, Framework> sourceFrameworkVersions)
public Framework AutoDetectFramework(List<string> sources, IDictionary<string, Framework> sourceFrameworkVersions, out bool isFrameworkIncompatible)
{
Framework framework = Framework.DefaultFramework;
isFrameworkIncompatible = false;
try
{
if (sources != null && sources.Count > 0)
{
var finalFx = DetermineFrameworkName(sources, sourceFrameworkVersions, out var conflictInFxIdentifier);
framework = Framework.FromString(finalFx.FullName);
if (conflictInFxIdentifier && EqtTrace.IsInfoEnabled)

if (conflictInFxIdentifier)
{
// TODO Log to console and client.
EqtTrace.Info(
"conflicts in Framework indentifier of provided sources(test assemblies), using default framework:{0}",
framework);
isFrameworkIncompatible = true;
if (EqtTrace.IsInfoEnabled)
{
// TODO Log to console and client.
EqtTrace.Info(
"conflicts in Framework indentifier of provided sources(test assemblies), using default framework:{0}",
framework);
}
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/vstest.console/Resources/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/vstest.console/Resources/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -718,4 +718,7 @@
<data name="InvalidLoggerArgument" xml:space="preserve">
<value>Logger argument '{0}' is not valid.</value>
</data>
<data name="ConflictInFrameworkPlatform" xml:space="preserve">
<value>Conflicts in framework/platform identifier of provided sources.</value>
Copy link
Contributor

@singhsarab singhsarab Oct 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to a more actionable message.
Suggestion:
"The given test sources target multiple frameworks/platforms that are incompatible. Please make sure the sources target the same framework and platform"

@PBoraMSFT @pvlakshm Can you please approve.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PBoraMSFT @pvlakshm Is this message "The given test sources target multiple frameworks/platforms that are incompatible. Please make sure the sources target the same framework and platform" okay?

</data>
</root>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">Zadání Framework35 není podporováno. U projektů mířících na .Net Framework 3.5 prosím použijte Framework40, aby testy v CLR 4.0 běžely v režimu kompatibility.</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">Framework35 wird nicht unterstützt. Verwenden Sie für Projekte, die auf .Net Framework 3.5 ausgerichtet sind, Framework40 zum Ausführen von Tests im "Kompatibilitätsmodus" von CLR 4.0.</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,11 @@
<target state="translated">No se admite Framework35. Para proyectos con destino .Net Framework 3.5, use Framework40 para ejecutar las pruebas en "modo de compatibilidad" de CLR 4.0.</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">Framework35 n'est pas pris en charge. Pour les projets ciblant .Net Framework 3.5, utilisez Framework40 pour exécuter les tests dans CLR 4.0 en "mode compatibilité".</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">Framework35 non è supportato. Per i progetti destinati a .NET Framework 3.5, usare Framework40 per eseguire i test nella modalità di compatibilità di CLR 4.0.</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">Framework35 はサポートされていません。.Net Framework 3.5 を対象とするプロジェクトでは、Framework40 を使用して CLR 4.0 の "互換モード" でテストを実行してください。</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">Framework35는 지원되지 않습니다. .NET Framework 3.5를 대상으로 하는 프로젝트의 경우 Framework40을 사용하여 CLR 4.0 "호환 모드"에서 테스트를 실행하세요.</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,11 @@
<target state="translated">Wersja Framework35 nie jest obsługiwana. W przypadku projektów przeznaczonych dla programu .Net Framework 3.5 użyj wersji Framework40 do uruchamiania testów w „trybie zgodności” CLR 4.0.</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.pt-BR.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,11 @@
<target state="translated">Não há suporte para Framework35. Para projetos com .Net Framework 3.5 de destino, use o Framework40 para executar testes em “modo de compatibilidade” CLR 4.0. </target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">Framework35 не поддерживается. В проектах для .Net Framework 3.5 запускайте тесты в режиме совместимости CLR 4.0 с использованием Framework40.</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">Framework35 desteklenmiyor. .NET Framework 3.5’i hedefleyen projeler için lütfen Framework40 kullanarak testleri CLR 4.0’ın “uyumluluk modunda” çalıştırın.</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,11 @@
<target state="new">Framework35 not supported. Use Framework40 or above to run tests in CLR 4.0 "compatibly mode".</target>
<note></note>
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">Framework35 不受支持。对于面向 .Net Framework 3.5 的项目,请使用 Framework40 在 CLR 4.0“兼容性模式”下运行测试。</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@
<target state="translated">不支援 Framework35。若為以 .Net Framework 3.5 為目標的專案,請使用 Framework40 在 CLR 4.0「相容模式」中執行測試。</target>
<note />
</trans-unit>
<trans-unit id="ConflictInFrameworkPlatform">
<source>Conflicts in framework/platform identifier of provided sources.</source>
<target state="new">Conflicts in framework/platform identifier of provided sources.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
17 changes: 13 additions & 4 deletions src/vstest.console/TestPlatformHelpers/TestRequestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,17 @@ private bool UpdateRunSettingsIfRequired(string runsettingsXml, List<string> sou

var navigator = document.CreateNavigator();

var inferedFramework = inferHelper.AutoDetectFramework(sources, sourceFrameworks);
var inferedFramework = inferHelper.AutoDetectFramework(sources, sourceFrameworks, out var isFrameworkIncompatible);
Copy link
Contributor

@singhsarab singhsarab Nov 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TryGetCompatibleFramework, and return true/false based on the detection #Resolved

Copy link
Contributor

@singhsarab singhsarab Nov 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Inferred #Resolved

Copy link
Contributor Author

@vagisha-nidhi vagisha-nidhi Nov 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How should be the method signature?
Current : public Framework AutoDetectFramework(List<string> sources, IDictionary<string, Framework> sourceFrameworkVersions, out bool isFrameworkIncompatible)
Possible public bool TryGetCompatibleFramework(List<string> sources, IDictionary<string, Framework> sourceFrameworkVersions, out Framework inferredFramework)
Shall I make this change? This was done to use the previous method signature as it is. #Resolved

Framework chosenFramework;
var inferedPlatform = inferHelper.AutoDetectArchitecture(sources, sourcePlatforms);
var inferedPlatform = inferHelper.AutoDetectArchitecture(sources, sourcePlatforms, out var isPlatformIncompatible);
Architecture chosenPlatform;

// Update frmaework and platform if required. For commandline scenario update happens in ArgumentProcessor.
if (isFrameworkIncompatible || isPlatformIncompatible)
{
throw new TestPlatformException(Resources.ConflictInFrameworkPlatform);
Copy link
Contributor

@singhsarab singhsarab Oct 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have separate messages? It just makes it clear which exactly caused the failure #Resolved

Copy link
Contributor Author

@vagisha-nidhi vagisha-nidhi Dec 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the message in the description #Resolved

}

// Update framework and platform if required. For commandline scenario update happens in ArgumentProcessor.
bool updateFramework = IsAutoFrameworkDetectRequired(navigator, out chosenFramework);
bool updatePlatform = IsAutoPlatformDetectRequired(navigator, out chosenPlatform);

Expand All @@ -386,11 +391,15 @@ private bool UpdateRunSettingsIfRequired(string runsettingsXml, List<string> sou
settingsUpdated = true;
}

var compatibleSources = InferRunSettingsHelper.FilterCompatibleSources(chosenPlatform, chosenFramework, sourcePlatforms, sourceFrameworks, out var incompatibleSettingWarning);
var compatibleSources = InferRunSettingsHelper.FilterCompatibleSources(chosenPlatform, chosenFramework, sourcePlatforms, sourceFrameworks, out var incompatibleSettingWarning, out var incompatibiltyErrorFound);

if (!string.IsNullOrEmpty(incompatibleSettingWarning))
{
EqtTrace.Info(incompatibleSettingWarning);
if(incompatibiltyErrorFound)
{
throw new TestPlatformException(incompatibleSettingWarning);
}
ConsoleLogger.RaiseTestRunWarning(incompatibleSettingWarning);
}

Expand Down
Loading