Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all 106942 articles
Browse latest View live

RSRP-400659: Incorrect convert field to a local variable refactoring when field usage with `this`

$
0
0
Reporter Alexander Zaytsev (hazzik) Alexander Zaytsev (hazzik)
Created Dec 18, 2013 12:52:01 AM
Updated Oct 12, 2018 3:53:48 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Major
State Submitted
Type Bug
Fix version Backlog
Affected versions 2018.1, 8.1, 8.1 EAP
Fixed In Version ReSharper Undefined
VsVersion All Versions
I have following code
public class MyClass
{
private int field;

public MyClass(int field1)
{
//NOTE: `this` qualifier.
this.field = field1;
DoSomethingWithField(this.field);
}

private void DoSomethingWithField(int i)
{
throw new NotImplementedException();
}
}

Convert to a local variable refactoring produces following code:
public class MyClass
{
private int field;

public MyClass(int field1)
{
//NOTE: `this` qualifier.
int field;
this.field = field1;
DoSomethingWithField(this.field);
}

private void DoSomethingWithField(int i)
{
throw new NotImplementedException();
}
}

If there is no this qualifiers then refactoring works perfectly.
public class MyClass
{
private int field;

public MyClass(int field1)
{
//NOTE: no `this` qualifier.
field = field1;
DoSomethingWithField(field);
}

private void DoSomethingWithField(int i)
{
throw new NotImplementedException();
}
}
is refactored to
public class MyClass
{
public MyClass(int field1)
{
//NOTE: `this` qualifier.
DoSomethingWithField(field1);
}

private void DoSomethingWithField(int i)
{
throw new NotImplementedException();
}
}


JetBrains ReSharper 8.1 C# Edition
Build 8.1.23.546 on 2013-12-11T14:30:52

RSRP-457683: badly formatted LINQ replacement with multiple Where clauses and comments

$
0
0
Reporter Alexander Kurakin (Alexander.Kurakin) Alexander Kurakin (Alexander.Kurakin)
Created Apr 8, 2016 4:03:16 PM
Updated Oct 12, 2018 3:55:56 PM
Resolved Oct 12, 2018 3:55:56 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Major
State Fixed
Type Bug
Fix version Unidentified prior version
Affected versions 2016.1
Fixed In Version ReSharper Undefined
VsVersion All Versions
new console app, put this in Main:
var foo = Enumerable 
.Range(-5, 10)
// some comment here
.Where(x => x > 0)
.Where(x => x%2 == 0)
.Any();
ReSharper suggests replacing it with a single call to Any - when it does, the result puts the first Where clause inside the comment, effectively removing it
var foo = Enumerable 
// some comment here
.Range(-5, 10)
// some comment here.Where(x => x > 0)
.Any(x => x%2 == 0);

RSRP-458587: Создание поля в конструкторе

$
0
0
Reporter Alexander Kurakin (Alexander.Kurakin) Alexander Kurakin (Alexander.Kurakin)
Created Apr 29, 2016 3:13:20 PM
Updated Oct 12, 2018 3:59:25 PM
Resolved Oct 12, 2018 3:59:25 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Duplicate
Type Feature
Fix version No Fix versions
Affected versions Backlog
Fixed In Version ReSharper Undefined
VsVersion All Versions
Сейчас при определении поля, решарпер предлагает инициализировать его в конструкторе родительского класса.
Но часто бывает нужно просто создать экземпляр этого поля в конструкторе. Решарпер мог бы предлагать такую возможность для классов, имеющих конструктор по умолчанию. А в более сложных случаях (когда конструктор класса поля имеет параметры) предлагать инициализировать их конкретными значениями, или делегировать через параметры конструктора родительского класса.

RSRP-337986: Add a default property initialization to constructor

$
0
0
Reporter Bojan Vrhovnik (bojanv) Bojan Vrhovnik (bojanv)
Created Feb 1, 2013 4:33:45 PM
Updated Oct 12, 2018 4:00:14 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Major
State Submitted
Type Feature
Fix version Backlog
Affected versions 2018.3
Fixed In Version ReSharper Undefined
VsVersion All Versions
Hi all!

My suggestion would be to add a default property initialization to a constructor (or multiple)from quick action.

For example:
public string Query{get;set;}
public List<MyClass> MyList{get;set;}

Press ALT+ENTER on the query and it will create a constructor (if not present - default) or add a default initialization to the existing one.

result:

public MyClassName(){
Query = "";
MyList = new List<MyClass>();
}

This functionality would be awesome. I tryed to make my own plugin, but had problem with reference types. Works great with simple value types though.

RSRP-471826: Resharper Installer needs local admin rights for Visual Studio 2017

$
0
0
Reporter peter wellstein (petercosmic) peter wellstein (petercosmic)
Created Oct 12, 2018 4:01:08 PM
Updated Oct 12, 2018 4:01:08 PM
Subsystem No Subsystem
Assignee Unassigned
Priority Normal
State Submitted
Type Unspecified
Fix version No Fix versions
Affected versions No Affected versions
Fixed In Version ReSharper Undefined
VsVersion All Versions
When trying to install JetBrains.ReSharperUltimate.2018.2.3.exe we face the issue that for integration with VS 2017 we apparently need local admin rights (not needed for VS2015). However this is prevented by company policy. Is there a way to get around it?

RSRP-460569: Bug report - Incorrect conversion of a foreach loop to LINQ to method chain

$
0
0
Reporter Alexander Kurakin (Alexander.Kurakin) Alexander Kurakin (Alexander.Kurakin)
Created Aug 30, 2016 2:40:54 PM
Updated Oct 12, 2018 4:05:58 PM
Resolved Oct 12, 2018 4:05:58 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Obsolete
Type Bug
Fix version Backlog
Affected versions 10.0.2, 2016.2
Fixed In Version ReSharper Undefined
VsVersion All Versions
The following code:
        private static string Identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue)
{
string result = string.Empty;
ManagementClass mc =
new ManagementClass(wmiClass);
ManagementObjectCollection moc = mc.GetInstances();
foreach (var o in moc)
{
var mo = (ManagementObject)o;
if (mo[wmiMustBeTrue].ToString() != "True") continue;
//Only get the first one
if (result == string.Empty)
{
try
{
result = mo[wmiProperty].ToString();
break;
}
catch
{
}
}
}
return result;
}
is incorrectly converted to:
        private static string Identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue)
{
string result = string.Empty;
ManagementClass mc =
new ManagementClass(wmiClass);
ManagementObjectCollection moc = mc.GetInstances();
foreach (var mo in
moc.Cast<ManagementObject>()
.Where(mo => mo[wmiMustBeTrue].ToString() == "True")
.Where(mo => result == string.Empty))
{
try
{
result = mo[wmiProperty].ToString();
break;
}
catch
{
}
}
return result;
}
Note that the query condition 'result == string.Empty' in the converted code is always as it takes only the initial value of 'result', where in the original code 'result' might change inside the loop.

RSRP-471816: Can't get solution active configuration

$
0
0
Reporter Tatyana Lunegova (lunega) Tatyana Lunegova (lunega)
Created Oct 11, 2018 3:54:28 PM
Updated Oct 12, 2018 4:11:49 PM
Subsystem Solution builder
Assignee Anton Spilnyy (Anton.Spilnyy)
Priority Normal
State Submitted
Type Exception
Fix version No Fix versions
Affected versions No Affected versions
Fixed In Version ReSharper Undefined
VsVersion All Versions
ReSharperPlatformVs15 Wave 183 Hive _cfcc61ab — JetBrains ReSharper Ultimate 2018.3 EAP 3 D Build 183.0.20181011.101501-eap03d

JetBrains dotCover 2018.3 EAP 3 D Build 2018.3.20181011.103028-eap03d
JetBrains dotMemory 2018.3 EAP 3 D Build 2018.3.20181011.102853-eap03d
JetBrains dotTrace 2018.3 EAP 3 D Build 2018.3.20181011.103023-eap03d
JetBrains ReSharper 2018.3 EAP 3 D Build 2018.3.20181011.102733-eap03d
JetBrains ReSharper C++ 2018.3 EAP 3 D Build 2018.3.20181011.102738-eap03d

SubProducts.0 = JetBrains dotCover 2018.3 EAP 3 D Build 2018.3.20181011.103028-eap03d
SubProducts.1 = JetBrains dotTrace 2018.3 EAP 3 D Build 2018.3.20181011.103023-eap03d
SubProducts.2 = JetBrains ReSharper C++ 2018.3 EAP 3 D Build 2018.3.20181011.102738-eap03d
SubProducts.3 = JetBrains ReSharper 2018.3 EAP 3 D Build 2018.3.20181011.102733-eap03d
SubProducts.4 = JetBrains dotMemory 2018.3 EAP 3 D Build 2018.3.20181011.102853-eap03d

Can't get solution active configuration

— EXCEPTION #1/1 [LoggerException]
Message = “Can't get solution active configuration”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
Data.ManagedThreadName = <NULL>
Data.SccRevisionShell = “<there are no packages matching the criteria>”
Data.HostProductInfo = “JetBrains ReSharper Ultimate 2018.3 EAP 3 D Build 183.0.20181011.101501-eap03d”
Data.SubProducts.#0 = “JetBrains dotCover 2018.3 EAP 3 D Build 2018.3.20181011.103028-eap03d”
Data.SubProducts.#1 = “JetBrains dotTrace 2018.3 EAP 3 D Build 2018.3.20181011.103023-eap03d”
Data.SubProducts.#2 = “JetBrains ReSharper C++ 2018.3 EAP 3 D Build 2018.3.20181011.102738-eap03d”
Data.SubProducts.#3 = “JetBrains ReSharper 2018.3 EAP 3 D Build 2018.3.20181011.102733-eap03d”
Data.SubProducts.#4 = “JetBrains dotMemory 2018.3 EAP 3 D Build 2018.3.20181011.102853-eap03d”
Data.SccRevisionEnv = “
Platform\Core\Shell:
    git::refs/heads/183::98cb0e156842e413b59a601d523bcd22c04b0fea


Platform\VisualStudio:
    git::refs/heads/183-winnie-res07

Data.VsVersion = 15.8.28010.2046
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
 at JetBrains.VsIntegration.IDE.SolutionBuilder.ConfigHolders.SolutionConfigurationHolderNew.Recalculate(Action afterRecalculate)
 at JetBrains.VsIntegration.IDE.SolutionBuilder.ConfigHolders.SolutionConfigurationHolderNew.Recalculate(Action afterRecalculate)
 at JetBrains.VsIntegration.IDE.SolutionBuilder.ConfigHolders.SolutionConfigurationHolder.<.ctor>b__9_1(Lifetime lt, ConfigurationCalculationMode val)
 at JetBrains.DataFlow.IPropertyEx.<>c__DisplayClass26_0`1.<ForEachValue>b__0(Lifetime lf, TValue value, Object cookie)
 at JetBrains.DataFlow.IPropertyEx.<>c__DisplayClass27_1`1.<ForEachValue>b__1(Lifetime lifetimeValue)
 at JetBrains.DataFlow.SequentialLifetimes.<>c__DisplayClass4_0.<Next>b__0(LifetimeDefinition definition, Lifetime lifetime)
 at JetBrains.DataFlow.Lifetimes.Define(Lifetime lifetime, String id, Action`2 FAtomic, ILog logger)
 at JetBrains.DataFlow.SequentialLifetimes.DefineNext(Action`2 FNext)
 at JetBrains.DataFlow.SequentialLifetimes.Next(Action`1 FNext)
 at JetBrains.DataFlow.IPropertyEx.<>c__DisplayClass27_0`1.<ForEachValue>b__0(PropertyChangedEventArgs`1 args)
 at JetBrains.DataFlow.Property`1.PropertyChangeSignal.Acknowledge(Action`1 handler, AddRemove addremove)
 at JetBrains.DataFlow.Property`1.PropertyChangeSignal.OnAfterAdvise(Action`1 handler)
 at JetBrains.DataFlow.Signal`1.<>c__DisplayClass19_0.<AdviseCore>b__0()
 at JetBrains.DataFlow.LifetimeDefinition.Bracket(Action opening, Action closing)
 at JetBrains.DataFlow.Signal`1.AdviseCore(Action`1 handler, Lifetime lifetime)
 at JetBrains.DataFlow.Signal`1.Advise(Lifetime lifetime, Action`1 handler)
 at JetBrains.DataFlow.IPropertyEx.ForEachValue[TValue](IProperty`1 property, Lifetime lifetime, Func`2 FCondition, Action`3 FHandler)
 at JetBrains.DataFlow.IPropertyEx.ForEachValue[TValue](IProperty`1 property, Lifetime lifetime, Func`2 FCondition, Action`2 FHandler)
 at JetBrains.VsIntegration.IDE.SolutionBuilder.ConfigHolders.SolutionConfigurationHolder..ctor(Lifetime lifetime, ILogger logger, ISolution solution, IShellLocks locks, ISettingsStore store, DTE dte, ProjectActiveConfigurationAccessor accessor, IVsHierarchies hierarchies, VsActiveConfigurationManager vsActiveConfigurationManager)
 at JetBrains.Platform.VisualStudio.SinceVs15.IDE.SolutionBuilder.SolutionConfigurationHolder15..ctor(Lifetime lifetime, ILogger logger, ISolution solution, IShellLocks locks, ISettingsStore store, DTE dte, ProjectActiveConfigurationAccessor accessor, IVsHierarchies hierarchies, ISolutionConfigurationBuilder15 solutionConfigurationBuilder15, LightSolutionLoadSettingsHolder holder, VsActiveConfigurationManager vsActiveConfigurationManager)
 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
 at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
 at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstanceOf(Type type, IValueResolveContext context)
 at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstance(IValueResolveContext context)
 at JetBrains.Application.Components.SingletonDescriptor.CreateInstanceChecked(OnError onError, IComponentContainer container)
 at JetBrains.Application.Components.SingletonDescriptor.GetValue()
 at JetBrains.Application.Components.SignatureResolution.BindArguments(List`1 argumentDescriptors, Object origin)
 at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstanceOf(Type type, IValueResolveContext context)
 at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstance(IValueResolveContext context)
 at JetBrains.Application.Components.SingletonDescriptor.CreateInstanceChecked(OnError onError, IComponentContainer container)
 at JetBrains.Application.Components.SingletonDescriptor.GetValue()
 at JetBrains.Application.Components.SignatureResolution.BindArguments(List`1 argumentDescriptors, Object origin)
 at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstanceOf(Type type, IValueResolveContext context)
 at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstance(IValueResolveContext context)
 at JetBrains.Application.Components.SingletonDescriptor.CreateInstanceChecked(OnError onError, IComponentContainer container)
 at JetBrains.Application.Components.SingletonDescriptor.GetValue()
 at JetBrains.Application.Components.SignatureResolution.BindArguments(List`1 argumentDescriptors, Object origin)
 at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstanceOf(Type type, IValueResolveContext context)
 at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstance(IValueResolveContext context)
 at JetBrains.Application.Components.SingletonDescriptor.CreateInstanceChecked(OnError onError, IComponentContainer container)
 at JetBrains.Application.Components.SingletonDescriptor.GetValue()
 at JetBrains.Application.Components.InitializationStrategyDefault.Schedule(Lifetime lifetime, ICollection`1 dscs, IComponentContainer container)
 at JetBrains.Application.Components.ComponentStorage.ComposeDescriptors(ICollection`1 descriptors)
 at JetBrains.Application.Components.ComponentStorage.Compose()
 at JetBrains.ProjectModel.SolutionInstance.OpenSolutionInstance(ISolutionLoadTasksScheduler taskScheduler)
 at JetBrains.ProjectModel.SolutionManagerBase.CreateSolutionInstance(SolutionElement solutionElement, SolutionInstance solutionInstance)
 at JetBrains.VsIntegration.ProjectDocuments.VSSolutionManager.<>c__DisplayClass36_0.<OpenVSSolution>b__0(Lifetime lifetime)
 at JetBrains.DataFlow.SequentialLifetimes.<>c__DisplayClass4_0.<Next>b__0(LifetimeDefinition definition, Lifetime lifetime)
 at JetBrains.DataFlow.Lifetimes.Define(Lifetime lifetime, String id, Action`2 FAtomic, ILog logger)
 at JetBrains.DataFlow.SequentialLifetimes.DefineNext(Action`2 FNext)
 at JetBrains.DataFlow.SequentialLifetimes.Next(Action`1 FNext)
 at JetBrains.VsIntegration.ProjectDocuments.VSSolutionManager.OpenVSSolution(Boolean openSolution, Boolean sync)
 at JetBrains.VsIntegration.ProjectDocuments.VSSolutionManager.<>c__DisplayClass33_0.<OnAfterOpenProject>b__0()
 at JetBrains.Util.ILoggerEx.Catch(ILogger thіs, Action F, ExceptionOrigin origin, LoggingLevel loggingLevel)
 at JetBrains.VsIntegration.Interop.VsInteropController.ExecuteActionsUnderProperLock(Boolean isWriteLockTaken)
 at JetBrains.VsIntegration.Interop.VsInteropController.ExecuteActionsUnderWriteLockOrReschedule()
 at JetBrains.Util.Concurrency.UnguardedCallbackMerger.<>c__DisplayClass8_1.<ExecuteOrQueueOrMerge>b__0()
 at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)
 at JetBrains.Threading.ReentrancyGuard.TryExecute(String name, Action action)
 at JetBrains.Threading.ReentrancyGuardEx.ExecuteOrQueue(ReentrancyGuard thіs, Lifetime lifetime, String name, Action F, TaskPriority priority)
 at JetBrains.Util.Concurrency.UnguardedCallbackMerger.ExecuteOrQueueOrMerge(Lifetime lifetimeQueue, String name, Action F)
 at JetBrains.VsIntegration.Interop.VsInteropController.DispatchActions()
 at JetBrains.VsIntegration.Interop.VsInteropController.ExecuteOrQueueOrMergeWithReadLockWhenTalkingToVsAllowed(Lifetime lifetime, String name, Boolean requiresWriteLock, Action action)
 at JetBrains.VsIntegration.ProjectDocuments.VSSolutionManager.OnAfterOpenProject(IVsHierarchy pHierarchy, Int32 fAdded)
 at JetBrains.Platform.VisualStudio.SinceVs10.ProjectDocuments.VsSolutionManager10.OnAfterOpenProject(IVsHierarchy pHierarchy, Int32 fAdded)
 at EnvDTE.SolutionClass.AddFromTemplate(String FileName, String Destination, String ProjectName, Boolean Exclusive)
 at Microsoft.VisualStudio.TemplateEngine.TemplateCreatorBase.<CreateAsync>d__10.MoveNext()
 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
 at Microsoft.VisualStudio.TemplateEngine.TemplateCreatorBase.CreateAsync(Solution solution, IProjectCreationMetadata creationMetadata, IReadOnlyDictionary`2 passthroughParams)
 at Microsoft.VisualStudio.TemplateEngine.Wizard.TemplateEngineWizard.<CreateProject>d__38.MoveNext()
 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
 at Microsoft.VisualStudio.TemplateEngine.Wizard.TemplateEngineWizard.CreateProject()
at Microsoft.VisualStudio.TemplateEngine.Wizard.TemplateEngineWizard.<Microsoft-VisualStudio-TemplateWizard-IWizard-RunFinished>d__37.MoveNext()
 at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
 at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
 at Microsoft.VisualStudio.TemplateEngine.Wizard.TemplateEngineWizard.Microsoft.VisualStudio.TemplateWizard.IWizard.RunFinished()
 at Microsoft.VisualStudio.TemplateWizard.Wizard.Execute(Object application, Int32 hwndOwner, Object[]& ContextParams, Object[]& CustomParams, wizardResult& retval)
 at EnvDTE100.Solution4.AddFromTemplateEx(String FileName, String Destination, String ProjectName, String SolutionName, Boolean Exclusive, UInt32 Options)
 at Microsoft.VisualStudio.Dialogs.ServiceHelper.AddProjectFromSelectedTemplate(INewProjectDialogData dialog, String projectPath, Boolean isExclusive)
 at Microsoft.VisualStudio.Dialogs.SVsDialogService.CreateProject(INewProjectDialogData npdd)
 at Microsoft.VisualStudio.Dialogs.SVsDialogService.InvokeDialog(VSNEWPROJECTDLGINFO dlgInfo, String& bstrLocation)
 at Microsoft.VisualStudio.Shell.Interop.IVsUIDataSource.Invoke(String verb, Object pvaIn, Object& pvaOut)
 at Microsoft.Internal.VisualStudio.PlatformUI.DataSource.Invoke(String verb, Object pvaIn, Object& pvaOut)
 at Microsoft.VisualStudio.PlatformUI.VsCommand.Execute(Object parameter)
 at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
 at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
 at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
 at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
 at System.Windows.Threading.DispatcherOperation.InvokeImpl()
 at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
 at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
 at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
 at System.Windows.Threading.DispatcherOperation.Invoke()
 at System.Windows.Threading.Dispatcher.ProcessQueue()
 at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
 at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
 at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
 at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
 at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
 at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
 at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

RSRP-460938: Replace '??' with left hand operand refactor breaks in razor views

$
0
0
Reporter Brian Surowiec (xt0rted) Brian Surowiec (xt0rted)
Created Sep 22, 2016 4:17:34 PM
Updated Oct 12, 2018 4:23:06 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Submitted
Type Bug
Fix version Backlog
Affected versions 2016.2, 2018.3
Fixed In Version ReSharper Undefined
VsVersion All Versions
Through some refactoring I came to the following:
<input type="date" value="@(Model.PaymentDate?.ToString("yyyy-MM-dd") ?? null)">

ReSharper is offering a quick fix to rewrite that with just the left hand portion of the ??. Sounds good so I selected it. But then my code was changed to:
<input type="date" value="@Model.PaymentDate?.ToString("yyyy-MM-dd")">

This introduces a bug into the code because of the null-conditional operator. The razor parser doesn't handle this so the expression needs to be wrapped in ( ), which it originally was.

The rendered output when PaymentDate is null is:
<input type="date" value="?.ToString("yyyy-MM-dd")">

RSRP-461111: Applying "use var when evident" in file/project/solution fixes ALL vars, not just the detected ones

$
0
0
Reporter Alexander Kurakin (Alexander.Kurakin) Alexander Kurakin (Alexander.Kurakin)
Created Oct 4, 2016 2:16:19 PM
Updated Oct 12, 2018 4:41:26 PM
Resolved Oct 12, 2018 4:41:26 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Critical
State Fixed
Type Bug
Fix version Unidentified prior version
Affected versions 2016.2.2
Fixed In Version ReSharper Undefined
VsVersion All Versions
With "Use var when evident" for simple types, ReSharper suggests to change "ProjectPage" to "var". If I apply a quick-fix in the entire file (or project, or solution), it will also change "Color" to "var", even though it did not suggest that change in the first place. This means that after the change, it suggests to change the first "var" back to Color. If I apply this file-wide too, I'm back where I started (with explicit "ProjectPage" which ReSharper suggests to change to "var").

This means that file-/project-/solution-wide application of the "use var when evident" quick-fix is useless, and I have to correct each var/explicit type individually.


            public void Doooo(string project)
{
Color barBackgroundColor = Color.FromHex("#FFFFFF");
ProjectPage projectPage = new ProjectPage(project);
}

public class ProjectPage
{
public ProjectPage(string
project)
{
throw new NotImplementedException();
}
}

public class Color
{
public static Color FromHex(string ffffff)
{
throw new NotImplementedException();
}
}

RSRP-451429: ReSharper UTR has unexpected behavior for debugging tests with same name and different parameters

RSRP-471827: Unit Test sees two tests with the same name but different signatures as the same test and executes only the 1st one

$
0
0
Reporter Andrey Simukov (Andrey.Simukov) Andrey Simukov (Andrey.Simukov)
Created Oct 12, 2018 4:44:13 PM
Updated Oct 12, 2018 4:45:43 PM
Subsystem Unit Testing
Assignee Eugene Strizhok (Eugene.Strizhok)
Priority Normal
State Submitted
Type Bug
Fix version No Fix versions
Affected versions 2018.2.3
Fixed In Version ReSharper Undefined
VsVersion All Versions
When I have two tests with the same name but different signatures, the windows do not show the tests as separate tests. Have a look at the attached file OrderServiceTest.cs

Set a breakpoint on the second method OrderService_ShouldBeBackwardsCompatible and try to debug it. You'll note that the breakpoint doesn't get hit.

These may be two separate issues.


Reproduced with R# 2018.2.3



RSRP-462530: is -> as refactoring

$
0
0
Reporter Olga Rodygina (olgarodygina) Olga Rodygina (olgarodygina)
Created Jan 12, 2017 12:24:47 PM
Updated Oct 12, 2018 4:48:27 PM
Resolved Oct 12, 2018 4:48:27 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Obsolete
Type Bug
Fix version No Fix versions
Affected versions 2016.3.1
Fixed In Version ReSharper Undefined
VsVersion All Versions
Apply the 'is -> as' refactoring, see attached image.
After that, the code is broken, i.e. cannot be compiled anymore.

RSRP-463118: Replace '>' with '

$
0
0
Reporter Olga Rodygina (olgarodygina) Olga Rodygina (olgarodygina)
Created Feb 16, 2017 4:22:05 PM
Updated Oct 12, 2018 4:53:11 PM
Resolved Oct 12, 2018 4:53:11 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Obsolete
Type Bug
Fix version No Fix versions
Affected versions 2016.3.2
Fixed In Version ReSharper Undefined
VsVersion All Versions
Before:

float a = 1;
float b = 2;
if (a > b)
{
Console.WriteLine("LOL");
}

After 'Replace '>' with '<='':

float a = 1;
float b = 2;
if (!(!(a > b)))
{
Console.WriteLine("LOL");
}

RSRP-464585: Mistake "Part of loop's body can be converted into LINQ-expression"

$
0
0
Reporter Bruno Logerfo (bclogerfo) Bruno Logerfo (bclogerfo)
Created Apr 28, 2017 8:19:43 PM
Updated Oct 12, 2018 4:59:04 PM
Resolved Oct 12, 2018 4:59:04 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Fixed
Type Bug
Fix version Unidentified prior version
Affected versions 2017.1.2, 2017.1
Fixed In Version ReSharper Undefined
VsVersion VS 2017 RTM
Resharper suggests "Part of loop's body can be converted into LINQ-expression" to the following code:

Which leads to this code:

Which leads to this compilation error:

Since the col variable scope changes, it cannot be accessed inside the loop anymore.

There are two ways to fix this behavior:
1) Never suggest LoopCanBePartlyConvertedToQuery when the if statement contains a named pattern.
2) Only transfer the clauses before the first named pattern from the if statement to the Where function - which, in this case, would be none, so the suggestion wouldn't appear at all.

I hope this is not a duplicate issue. I couldn't find anything related in my searches, but I'm kinda new in YouTrack.

RSRP-471508: CA to convert null coalescing operator to if statement

$
0
0
Reporter Andrey Dyatlov (Andrey.Dyatlov) Andrey Dyatlov (Andrey.Dyatlov)
Created Sep 14, 2018 6:52:59 PM
Updated Oct 12, 2018 5:01:55 PM
Subsystem Context Actions
Assignee Andrey Dyatlov (Andrey.Dyatlov)
Priority Normal
State Fixed In Branch
Type Feature
Fix version Backlog
Affected versions No Affected versions
Fixed In Version ReSharper Undefined
VsVersion All Versions
I have the following line:
var something = GetSomething() ?? myDefaultValueSerivce.CreateValue<ISomething>();

however if I want to change the fallback path to more complicated code that cannot be fit into a single expression I can't easily transform it with ReSharper to the following form:

var something = GetSomething();
if (something == null)
{
something = myDefaultValueSerivce.CreateValue<ISomething>();
}

A possible workaround in form of To conditional expression -> Convert to if statement CA combination is not always available and produces much more cumbersome version:

ISomething something;
if (GetSomething() != null)
something = GetSomething();
else
something = myDefaultValueSerivce.CreateValue<ISomething>();

Note that the suggested transformation will be invalid in case it's not the first expression in statement or if the inferred type will change and the desired type can't be used explicitly.

RSRP-464781: QF 'remove braces' removes comment

$
0
0
Reporter Olga Rodygina (olgarodygina) Olga Rodygina (olgarodygina)
Created May 15, 2017 11:58:22 AM
Updated Oct 12, 2018 5:02:06 PM
Subsystem Context Actions
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Submitted
Type Bug
Fix version Backlog
Affected versions 2017.1.2, 2018.3
Fixed In Version ReSharper Undefined
VsVersion All Versions
I have the following code:
            if (a > b) { return 0; }    // Comment...
If I put the mouse on the opening brace I get the suggestion "Remove Braces". Fine. Except that R# also removes my comment following the closing brace.

RSRP-470260: DynamicData in MsTest v2

$
0
0
Reporter Erik Andersson (erandersson) Erik Andersson (erandersson)
Created Jun 21, 2018 11:21:10 AM
Updated Oct 12, 2018 5:07:11 PM
Subsystem Unit Testing
Assignee Eugene Strizhok (Eugene.Strizhok)
Priority Normal
State Reopened
Type Bug
Fix version 2018.3
Affected versions No Affected versions
Fixed In Version ReSharper Undefined
VsVersion All Versions

There's an incorrect behavior in the unit test runner, causing it to report success when the visual studio testrunner (correctly) fails the test.

Reproduced using the following class, targeting Microsoft.VisualStudio.TestPlatform.TestFramework v1.3.2, added from NuGet

using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestProject
{
    [TestClass]
    public class TestTest
    {
        [DataTestMethod]
        [DynamicData(nameof(GetData))]
        public void TestMethod1(bool whatever, int[] expected, int[] actual)
        {
            Assert.IsTrue(whatever);
            CollectionAssert.AreEqual(actual, expected);
        }

        public static IEnumerable<object[]> GetData =>
            new[]
            {
                new object[] {true, new[] {1, 2, 3}, new[] {1, 2, 3}},
                new object[] {true, new[] {1, 2, 3}, new[] {0, 0, 0}},
                new object[] {true, new[] {1, 2, 3}, new[] {1, 2, 3}},
            };
    }
}

Using the code above the resharper test runner will report success and visual studio test runner will report fail. The latter being correct because of the second test case in GetData

RSRP-465311: Import missing reference fix inserts casts

$
0
0
Reporter Alexander Kurakin (Alexander.Kurakin) Alexander Kurakin (Alexander.Kurakin)
Created Jul 3, 2017 6:45:51 PM
Updated Oct 12, 2018 5:24:56 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Submitted
Type Bug
Fix version Backlog
Affected versions 2017.1.2, 2018.3
Fixed In Version ReSharper Undefined
VsVersion All Versions
I'll be refering to the code inside the attached solution.

Steps to reproduce:
1.Open solution Problem.sln
2.Restore packages (packages System.Reactive.* are referenced)
3.Open ClassUnderFix.cs in the editor
4.In 6th line, use the "Import missing references in file" fix on the "IDisposable" text.

Expected outcome:
The line "using System;" is placed at the top of the file, code inside the ClassUnderFix is unchanged.
The expected outcome can be seen in the "ExpectedFixOutcome.cs" file.

Actual outcome:
The line "using System;" is placed at the top of the file and an unwanted cast is inserted.
The cast appears inside the "Subscribe" method call, in the "Start" method:
before the fix: "_subscription = _store.Changes().Subscribe(OnStoreChanged);"
after the fix: "_subscription = _store.Changes().Subscribe((IObserver<int>) OnStoreChanged);
The actual outcome, as it appeared on my machine, can also be seen in the "ActualFixOutcome.cs" file.

RSRP-466121: Unable to perform any solution-wide refactoring on large solutions.

$
0
0
Reporter Thijs Tijsma (thijstijsma) Thijs Tijsma (thijstijsma)
Created Sep 2, 2017 3:10:50 PM
Updated Oct 12, 2018 5:28:10 PM
Subsystem Quick Fixes
Assignee Lilia Shamsutdinova (Lilia.Shamsutdinova)
Priority Normal
State To Reproduce
Type Bug
Fix version No Fix versions
Affected versions 2017.2
Fixed In Version ReSharper Undefined
VsVersion VS 2017 15.6
I'm trying to clean up a legacy code base and I want to use ReSharper to do so.

The issue I'm having is that when I select "Remove unused namespaces... in solution" it crashes halfway through the solution (~2500 of ~5500 files). It might be because ReSharper is trying to open all those unsaved documents?

It would be great if there was a way to override this behavior if that's the behavior that's causing it.

Kind regards,

Thijs Tijsma

RSRP-466225: Invalid refactoring suggested

$
0
0
Reporter Olga Rodygina (olgarodygina) Olga Rodygina (olgarodygina)
Created Sep 12, 2017 2:50:32 PM
Updated Oct 12, 2018 5:29:37 PM
Resolved Oct 12, 2018 5:29:37 PM
Subsystem Quick Fixes
Assignee Alisa Afonina (alisa.afonina)
Priority Normal
State Fixed
Type Bug
Fix version Unidentified prior version
Affected versions 2017.2
Fixed In Version ReSharper Undefined
VsVersion All Versions
On a line of code like:

return value == null ? default(T) : (T) value;

The suggestion is made to merge the conditional expression, however when T is a value-type the code will throw when value == null as the null cannot be casted to T in such a case...
Viewing all 106942 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>