Multi-line string fields (using @) aren't Regionerated

If you find any bugs, please post them here.

Multi-line string fields (using @) aren't Regionerated

Postby fre0n » Fri Sep 18, 2009 9:35 pm

Using the following configuration:
Code: Select all
<CodeLayout xmlns="http://regionerate.net/schemas/0.7.3.0/CodeLayout.xsd">

  <ForEach Type="Class">
    <CreateRegion Title="Fields">
      <PutFields>
      </PutFields>
    </CreateRegion>
  </ForEach>
 
  <Configuration>
    <Symbol>
      <HiddenDragon />
    </Symbol>
    <Unpack>
      <Regions ThatMatch="\[rgn\]" />
    </Unpack>
    <Rendering ShowCount="false" UseTabs="true" />
  </Configuration>
 
</CodeLayout>

...and the following test code:
Code: Select all
namespace Test
{
    public class Class1
    {
        public string Field1 = @"Field1";
        public string Field2 =
@"Field2";
        public string Field3 =
@"Field3
Field3";
        public string Field4 = @"Field4
Field4";
    }
}

...you can see that Field1 and Field2 are being Regionerated, but not Field3 and Field4:
Code: Select all
namespace Test
{
    public class Class1
    {
      #region Fields 

        public string Field1 = @"Field1";
        public string Field2 =
@"Field2";

      #endregion Fields 
        public string Field3 =
@"Field3
Field3";
        public string Field4 = @"Field4
Field4";
    }
}
fre0n
 
Posts: 2
Joined: Wed Sep 02, 2009 9:44 pm

Re: Multi-line string fields (using @) aren't Regionerated

Postby sabrina_c » Fri May 21, 2010 4:54 pm

I have too a problem with these kind of fields so I add what happens to me:
I have constants with multiline string fields that usually contain SQL Server Query code.

1) In one case, the constant is just put at the end of the class.
2) In the other case Visual Studio hangs, with the disk writing furiously as if it was allocating megabytes of ram and the swap disk was trying to follow the requests, while the cooling fan goes to maximum speed.

The machine is running Visual Studio 2010 on Vista Business 32Bit.
A message appears on visual studio status bar telling the following:
[16.50.09]Regionerate: non critical warning : the following unrecognized piece of code was detected "private const string SQL_GetThreadConnections = @"....
the rest of the string goes beyond the monitor size anywhay the problem is with the constants so I put them in this message to let you try what happens,
I gave a try in a class1 object creating a simple region around the constructor and the hang on happens imediately.

These are the incriminated constants

Code: Select all
      private const string SQL_GetThreadConnections = @"
SELECT IDAzienda, IDGenericConnection, IDTabellaTo, PKTabellaTo,
   CASE WHEN IDTabellaTo = 'TbForumsThreads' THEN
     (SELECT DDForumsThread FROM TbForumsThreads thr WHERE thr.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), thr.IDForumsThread) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbContacts' THEN
     (SELECT IDContactSearch FROM TbContacts ctt WHERE ctt.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), ctt.IDContact) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbContactsPersone' THEN
     (SELECT isnull(IDContactsTitolo,'')+ isnull(DDContactPersonaNome,'') +' '+ isnull(DDContactsPersonaCognome,'') AS Persona FROM TbContactsPersone per WHERE per.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), per.IDContactPersona) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbDocumentiTs' THEN
     (SELECT CodiceDocumento+' '+ isnull(DDDocumento,'') +' '+ isnull(Convert(nvarchar(10), DataDocumento, 103),'') AS Documento FROM TbDocumentiTs dts WHERE dts.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), dts.IDDocumentoTs) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbDocumentiRg' THEN
     (SELECT CodiceDocumento+' '+ isnull(Revisione,'') +' '+ isnull(DDDocumento,'') AS Documento FROM TbDocumentiRg drg WHERE drg.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), drg.IDDocumentoRg) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbDocumentiSpaziElements' THEN
     (SELECT CodeDocumentiSpaziElement+' '+ isnull(DDDocumentiSpaziElement,'') AS Spazio FROM TbDocumentiSpaziElements spz WHERE spz.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), spz.IDDocumentiSpaziElement) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbWorkItems' THEN
     (SELECT isnull(Convert(nvarchar(10), StartDatetime, 103),'')+' '+ isnull(DDWorkitem,'') AS Scadenza FROM TbWorkItems sca WHERE sca.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), sca.IDWorkItem) = cnn.PKTabellaTo)
   ELSE
      'Tabella non definita: ' + cnn.IDTabellaTo +' '+ cnn.PKTabellaTo
END
   
AS DDConnection
  FROM [TbGenericConnections] cnn

WHERE
   (cnn.IDAzienda = @IDAzienda
AND
   cnn.IDTabellaFrom = 'TbForumsThreads'
AND
   cnn.PKTabellaFrom = @IDForumsThread)";

      private const string SQL_GetRootThreadConnections = @"
SELECT IDAzienda, IDGenericConnection, IDTabellaTo, PKTabellaTo,
   CASE WHEN IDTabellaTo = 'TbForumsThreads' THEN
     (SELECT DDForumsThread FROM TbForumsThreads thr WHERE thr.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), thr.IDForumsThread) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbContacts' THEN
     (SELECT IDContactSearch FROM TbContacts ctt WHERE ctt.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), ctt.IDContact) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbContactsPersone' THEN
     (SELECT isnull(IDContactsTitolo,'')+ isnull(DDContactPersonaNome,'') +' '+ isnull(DDContactsPersonaCognome,'') AS Persona FROM TbContactsPersone per WHERE per.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), per.IDContactPersona) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbDocumentiTs' THEN
     (SELECT CodiceDocumento+' '+ isnull(DDDocumento,'') +' '+ isnull(Convert(nvarchar(10), DataDocumento, 103),'') AS Documento FROM TbDocumentiTs dts WHERE dts.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), dts.IDDocumentoTs) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbDocumentiRg' THEN
     (SELECT CodiceDocumento+' '+ isnull(Revisione,'') +' '+ isnull(DDDocumento,'') AS Documento FROM TbDocumentiRg drg WHERE drg.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), drg.IDDocumentoRg) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbDocumentiSpaziElements' THEN
     (SELECT CodeDocumentiSpaziElement+' '+ isnull(DDDocumentiSpaziElement,'') AS Spazio FROM TbDocumentiSpaziElements spz WHERE spz.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), spz.IDDocumentiSpaziElement) = cnn.PKTabellaTo)
      WHEN IDTabellaTo = 'TbWorkItems' THEN
     (SELECT isnull(Convert(nvarchar(10), StartDatetime, 103),'')+' '+ isnull(DDWorkitem,'') AS Scadenza FROM TbWorkItems sca WHERE sca.IDAZienda = cnn.IDAzienda and
         convert(nvarchar(255), sca.IDWorkItem) = cnn.PKTabellaTo)
   ELSE
      'Tabella non definita: ' + cnn.IDTabellaTo +' '+ cnn.PKTabellaTo
END
   
AS DDConnection
FROM
(
SELECT [IDAzienda]
      ,[IDGenericConnection]
      ,[IDTabellaTo]
      ,[PKTabellaTo]
  FROM [TbGenericConnections] gcn

WHERE
   (gcn.IDAzienda = @IDAzienda
AND
   gcn.IDTabellaFrom = 'TbForumsThreads'
AND
   gcn.PKTabellaFrom = @IDForumsThread)
   OR
   Exists (SELECT 1 FROM TbForumsThreads thr WHERE
      convert( nvarchar(255), thr.IDForumsThreadAncestor) = @IDForumsThread
      AND thr.IDAzienda = gcn.IDAzienda AND  convert( nvarchar(255), thr.IDForumsThread) = gcn.[PKTabellaFrom])) cnn
";


hope this can help
regards
Sabrina
sabrina_c
 
Posts: 2
Joined: Mon Mar 08, 2010 4:54 pm


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest